parameters: (self, command, expect_rc=None, timeout=_DEFAULT_TIMEOUT,
              retries=_DEFAULT_RETRIES)
return_statement: return output
docstring: Runs a shell command on the device.
  
      Args:
        command: The shell command to run.
        expect_rc: (optional) If set checks that the command's return code matches
          this value.
        timeout: (optional) Timeout per try in seconds.
        retries: (optional) Number of retries to attempt.
  
      Returns:
        The output of the shell command as a string.
  
      Raises:
        CommandFailedError: If the return code doesn't match |expect_rc|.
docstring_summary: Runs a shell command on the device.
docstring_tokens: Runs a shell command on the device .
function: def Shell(self, command, expect_rc=None, timeout=_DEFAULT_TIMEOUT,
              retries=_DEFAULT_RETRIES):
      """Runs a shell command on the device.
  
      Args:
        command: The shell command to run.
        expect_rc: (optional) If set checks that the command's return code matches
          this value.
        timeout: (optional) Timeout per try in seconds.
        retries: (optional) Number of retries to attempt.
  
      Returns:
        The output of the shell command as a string.
  
      Raises:
        CommandFailedError: If the return code doesn't match |expect_rc|.
      """
      if expect_rc is None:
        actual_command = command
      else:
        actual_command = '%s; echo $?;' % command
      output = self._DeviceAdbCmd(
          ['shell', actual_command], timeout, retries, check_error=False)
      if expect_rc is not None:
        output_end = output.rstrip().rfind('\n') + 1
        rc = output[output_end:].strip()
        output = output[:output_end]
        if int(rc) != expect_rc:
          raise CommandFailedError(
              ['shell', command],
              'shell command exited with code: %s' % rc,
              self._device_serial)
      return output
function_tokens: def Shell ( self , command , expect_rc = None , timeout = _DEFAULT_TIMEOUT , retries = _DEFAULT_RETRIES ) : if expect_rc is None : actual_command = command else : actual_command = '%s; echo $?;' % command output = self . _DeviceAdbCmd ( [ 'shell' , actual_command ] , timeout , retries , check_error = False ) if expect_rc is not None : output_end = output . rstrip ( ) . rfind ( '\n' ) + 1 rc = output [ output_end : ] . strip ( ) output = output [ : output_end ] if int ( rc ) != expect_rc : raise CommandFailedError ( [ 'shell' , command ] , 'shell command exited with code: %s' % rc , self . _device_serial ) return output