Re-format all codes to Google style. (#713)

* Add a config file for yapf
* Clarify the pre-submit steps in CONTRIBUTION.
diff --git a/.style.yapf b/.style.yapf
new file mode 100644
index 0000000..38ecc35
--- /dev/null
+++ b/.style.yapf
@@ -0,0 +1,5 @@
+[style]
+based_on_style = google
+indent_width: 2
+spaces_before_comment = 2
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2dda126..d9bdd95 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,7 +1,8 @@
 # Contributing
-Want to contribute? Great! First, read this page (including the small print at the end).
+Want to contribute? Great! First, read this page.
 
-### Before you contribute
+
+## Before you contribute
 Before we can use your code, you must sign the
 [Google Individual Contributor License Agreement]
 (https://cla.developers.google.com/about/google-individual)
@@ -17,11 +18,41 @@
 possibly guide you. Coordinating up front makes it much easier to avoid
 frustration later on.
 
-### Code reviews
-All submissions, including submissions by project members, require review. We
-use GitHub pull requests for this purpose.
-
 ### The small print
 Contributions made by corporations are covered by a different agreement than
 the one above, the
 [Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
+
+## Pre-submit Steps
+
+### Code reviews
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose.
+
+### Testing
+To run the unit tests for Mobly to verify your local changes:
+
+Make sure you have `tox` installed:
+```sh
+pip3 install tox
+```
+
+Then in the Mobly directory, run:
+```sh
+mobly $ tox
+```
+
+### Code style
+Before pushing your changes, you need to lint the code style via `yapf`
+
+To install `yapf`:
+
+```sh
+$ pip3 install yapf
+```
+
+To lint the code:
+
+```sh
+mobly $ yapf -i {files you modified}
+```
diff --git a/README.md b/README.md
index 299ce56..60638e8 100644
--- a/README.md
+++ b/README.md
@@ -69,19 +69,6 @@
 * [Mobly AndroidDevice Service](docs/android_device_service.md) -
 Create custom service to attach to Mobly's `AndroidDevice` controller.
 
-## Test
-To run the unit tests for Mobly to verify your local changes:
-
-Make sure you have `tox` installed:
-```sh
-pip install tox
-```
-
-Then in the Mobly directory, run:
-```sh
-tox
-```
-
 ## Mobly Snippet
 The Mobly Snippet projects let users better control Android devices.
 
diff --git a/docs/conf.py b/docs/conf.py
index c116c19..d08be89 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,7 +20,6 @@
 import sys
 sys.path.insert(0, os.path.abspath(os.path.pardir))
 
-
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
@@ -30,20 +29,19 @@
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = ['sphinx.ext.autodoc',
-    'sphinx.ext.napoleon',
-    'sphinx.ext.todo',
-    'sphinx.ext.viewcode']
+extensions = [
+    'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.todo',
+    'sphinx.ext.viewcode'
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
-
 # Setting up parsers for MD support
 from recommonmark.parser import CommonMarkParser
 
 source_parsers = {
-        '.md': CommonMarkParser,
+    '.md': CommonMarkParser,
 }
 
 # The suffix(es) of source filenames.
@@ -79,12 +77,10 @@
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 # This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build',
-    'Thumbs.db',
-    '.DS_Store',
-    'tutorial.md',
-    'instrumentation_tutorial.md',
-    'android_device_service.md']
+exclude_patterns = [
+    '_build', 'Thumbs.db', '.DS_Store', 'tutorial.md',
+    'instrumentation_tutorial.md', 'android_device_service.md'
+]
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
@@ -92,7 +88,6 @@
 # If true, `todo` and `todoList` produce output, else they produce nothing.
 todo_include_todos = True
 
-
 # -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
@@ -111,13 +106,11 @@
 # so a file named "default.css" will overwrite the builtin "default.css".
 html_static_path = []
 
-
 # -- Options for HTMLHelp output ------------------------------------------
 
 # Output file base name for HTML help builder.
 htmlhelp_basename = 'Moblydoc'
 
-
 # -- Options for LaTeX output ---------------------------------------------
 
 latex_elements = {
@@ -142,20 +135,14 @@
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-    (master_doc, 'Mobly.tex', u'Mobly Documentation',
-     u'Ang Li', 'manual'),
+    (master_doc, 'Mobly.tex', u'Mobly Documentation', u'Ang Li', 'manual'),
 ]
 
-
 # -- Options for manual page output ---------------------------------------
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
-man_pages = [
-    (master_doc, 'mobly', u'Mobly Documentation',
-     [author], 1)
-]
-
+man_pages = [(master_doc, 'mobly', u'Mobly Documentation', [author], 1)]
 
 # -- Options for Texinfo output -------------------------------------------
 
@@ -163,13 +150,11 @@
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-    (master_doc, 'Mobly', u'Mobly Documentation',
-     author, 'Mobly', 'Mobly is a Python-based test framework that specializes in supporting tests that require multiple devices, complex environments, or custom hardware setups.',
+    (master_doc, 'Mobly', u'Mobly Documentation', author, 'Mobly',
+     'Mobly is a Python-based test framework that specializes in supporting tests that require multiple devices, complex environments, or custom hardware setups.',
      'Miscellaneous'),
 ]
 
-
-
 # -- Options for Epub output ----------------------------------------------
 
 # Bibliographic Dublin Core info.
@@ -189,5 +174,3 @@
 
 # A list of files that should not be packed into the epub file.
 epub_exclude_files = ['search.html']
-
-
diff --git a/mobly/asserts.py b/mobly/asserts.py
index 3a63ccc..04a556d 100644
--- a/mobly/asserts.py
+++ b/mobly/asserts.py
@@ -17,7 +17,6 @@
 
 from mobly import signals
 
-
 # Have an instance of unittest.TestCase so we could reuse some logic from
 # python's own unittest.
 _pyunit_proxy = unittest.TestCase()
@@ -71,10 +70,10 @@
 
 
 def assert_raises_regex(expected_exception,
-            expected_regex,
-            extras=None,
-            *args,
-            **kwargs):
+                        expected_regex,
+                        extras=None,
+                        *args,
+                        **kwargs):
   """Assert that an exception is raised when a function is called.
 
   If no exception is raised, test fail. If an exception is raised but not
@@ -93,8 +92,8 @@
       test result.
   """
   context = _AssertRaisesContext(expected_exception,
-                   expected_regex,
-                   extras=extras)
+                                 expected_regex,
+                                 extras=extras)
   return context
 
 
@@ -272,8 +271,7 @@
         exc_name = self.expected.__name__
       except AttributeError:
         exc_name = str(self.expected)
-      raise signals.TestFailure('%s not raised' % exc_name,
-                    extras=self.extras)
+      raise signals.TestFailure('%s not raised' % exc_name, extras=self.extras)
     if not issubclass(exc_type, self.expected):
       # let unexpected exceptions pass through
       return False
@@ -285,8 +283,7 @@
     if isinstance(expected_regexp, str):
       expected_regexp = re.compile(expected_regexp)
     if not expected_regexp.search(str(exc_value)):
-      raise signals.TestFailure(
-        '"%s" does not match "%s"' %
-        (expected_regexp.pattern, str(exc_value)),
-        extras=self.extras)
+      raise signals.TestFailure('"%s" does not match "%s"' %
+                                (expected_regexp.pattern, str(exc_value)),
+                                extras=self.extras)
     return True
diff --git a/mobly/base_instrumentation_test.py b/mobly/base_instrumentation_test.py
index 2561025..504af1c 100644
--- a/mobly/base_instrumentation_test.py
+++ b/mobly/base_instrumentation_test.py
@@ -144,19 +144,19 @@
   """
 
   TIMING = [
-    _InstrumentationStatusCodes.START,
-    _InstrumentationStatusCodes.IN_PROGRESS,
+      _InstrumentationStatusCodes.START,
+      _InstrumentationStatusCodes.IN_PROGRESS,
   ]
   PASS = [
-    _InstrumentationStatusCodes.OK,
+      _InstrumentationStatusCodes.OK,
   ]
   FAIL = [
-    _InstrumentationStatusCodes.ERROR,
-    _InstrumentationStatusCodes.FAILURE,
+      _InstrumentationStatusCodes.ERROR,
+      _InstrumentationStatusCodes.FAILURE,
   ]
   SKIPPED = [
-    _InstrumentationStatusCodes.IGNORED,
-    _InstrumentationStatusCodes.ASSUMPTION_FAILURE,
+      _InstrumentationStatusCodes.IGNORED,
+      _InstrumentationStatusCodes.ASSUMPTION_FAILURE,
   ]
 
 
@@ -303,9 +303,9 @@
   """
 
   def __init__(self,
-         state=_InstrumentationBlockStates.UNKNOWN,
-         prefix=None,
-         previous_instrumentation_block=None):
+               state=_InstrumentationBlockStates.UNKNOWN,
+               prefix=None,
+               previous_instrumentation_block=None):
     self.state = state
     self.prefix = prefix
     self.previous_instrumentation_block = previous_instrumentation_block
@@ -320,13 +320,13 @@
 
     self.current_key = _InstrumentationKnownStatusKeys.STREAM
     self.known_keys = {
-      _InstrumentationKnownStatusKeys.STREAM: [],
-      _InstrumentationKnownStatusKeys.CLASS: [],
-      _InstrumentationKnownStatusKeys.ERROR: [],
-      _InstrumentationKnownStatusKeys.STACK: [],
-      _InstrumentationKnownStatusKeys.TEST: [],
-      _InstrumentationKnownResultKeys.LONGMSG: [],
-      _InstrumentationKnownResultKeys.SHORTMSG: [],
+        _InstrumentationKnownStatusKeys.STREAM: [],
+        _InstrumentationKnownStatusKeys.CLASS: [],
+        _InstrumentationKnownStatusKeys.ERROR: [],
+        _InstrumentationKnownStatusKeys.STACK: [],
+        _InstrumentationKnownStatusKeys.TEST: [],
+        _InstrumentationKnownResultKeys.LONGMSG: [],
+        _InstrumentationKnownResultKeys.SHORTMSG: [],
     }
     self.unknown_keys = defaultdict(list)
 
@@ -381,8 +381,8 @@
     """
     self._empty = False
     self.status_code = self._remove_structure_prefix(
-      _InstrumentationStructurePrefixes.STATUS_CODE,
-      status_code_line,
+        _InstrumentationStructurePrefixes.STATUS_CODE,
+        status_code_line,
     )
     if self.status_code == _InstrumentationStatusCodes.START:
       self.begin_time = utils.get_current_epoch_time()
@@ -401,8 +401,8 @@
     """
     self._empty = False
     key_value = self._remove_structure_prefix(
-      structure_prefix,
-      key_line,
+        structure_prefix,
+        key_line,
     )
     if '=' in key_value:
       (key, value) = key_value.split('=', 1)
@@ -456,9 +456,9 @@
       return self
     else:
       next_block = _InstrumentationBlock(
-        state=new_state,
-        prefix=self.prefix,
-        previous_instrumentation_block=self,
+          state=new_state,
+          prefix=self.prefix,
+          previous_instrumentation_block=self,
       )
       if self.status_code in _InstrumentationStatusCodeCategories.TIMING:
         next_block.begin_time = self.begin_time
@@ -480,10 +480,10 @@
     self._unknown_keys = {}
     for key, value in instrumentation_block.known_keys.items():
       self._known_keys[key] = '\n'.join(
-        instrumentation_block.known_keys[key]).rstrip()
+          instrumentation_block.known_keys[key]).rstrip()
     for key, value in instrumentation_block.unknown_keys.items():
       self._unknown_keys[key] = '\n'.join(
-        instrumentation_block.unknown_keys[key]).rstrip()
+          instrumentation_block.unknown_keys[key]).rstrip()
     self._begin_time = instrumentation_block.begin_time
 
   def _get_name(self):
@@ -510,8 +510,7 @@
       name.
     """
     class_parts = [
-      self._prefix,
-      self._known_keys[_InstrumentationKnownStatusKeys.CLASS]
+        self._prefix, self._known_keys[_InstrumentationKnownStatusKeys.CLASS]
     ]
     return '.'.join(filter(None, class_parts))
 
@@ -548,20 +547,18 @@
     for value in self._unknown_keys.values():
       extra_parts.append(value)
 
+    extra_parts.append(self._known_keys[_InstrumentationKnownStatusKeys.STREAM])
     extra_parts.append(
-      self._known_keys[_InstrumentationKnownStatusKeys.STREAM])
+        self._known_keys[_InstrumentationKnownResultKeys.SHORTMSG])
     extra_parts.append(
-      self._known_keys[_InstrumentationKnownResultKeys.SHORTMSG])
-    extra_parts.append(
-      self._known_keys[_InstrumentationKnownResultKeys.LONGMSG])
-    extra_parts.append(
-      self._known_keys[_InstrumentationKnownStatusKeys.ERROR])
+        self._known_keys[_InstrumentationKnownResultKeys.LONGMSG])
+    extra_parts.append(self._known_keys[_InstrumentationKnownStatusKeys.ERROR])
 
     if self._known_keys[
         _InstrumentationKnownStatusKeys.STACK] not in self._known_keys[
-          _InstrumentationKnownStatusKeys.STREAM]:
+            _InstrumentationKnownStatusKeys.STREAM]:
       extra_parts.append(
-        self._known_keys[_InstrumentationKnownStatusKeys.STACK])
+          self._known_keys[_InstrumentationKnownStatusKeys.STACK])
 
     return '\n'.join(filter(None, extra_parts))
 
@@ -577,9 +574,8 @@
     """
     if self._status_code in _InstrumentationStatusCodeCategories.FAIL:
       return True
-    elif (self._known_keys[_InstrumentationKnownStatusKeys.STACK]
-        and self._status_code !=
-        _InstrumentationStatusCodes.ASSUMPTION_FAILURE):
+    elif (self._known_keys[_InstrumentationKnownStatusKeys.STACK] and
+          self._status_code != _InstrumentationStatusCodes.ASSUMPTION_FAILURE):
       return True
     elif self._known_keys[_InstrumentationKnownStatusKeys.ERROR]:
       return True
@@ -605,33 +601,29 @@
     extras = self._get_extras()
 
     tr_record = records.TestResultRecord(
-      t_name=self._get_full_name(),
-      t_class=mobly_test_class,
+        t_name=self._get_full_name(),
+        t_class=mobly_test_class,
     )
     if self._begin_time:
       tr_record.begin_time = self._begin_time
 
     if self._is_failed():
-      tr_record.test_fail(
-        e=signals.TestFailure(details=details, extras=extras))
+      tr_record.test_fail(e=signals.TestFailure(details=details, extras=extras))
     elif self._status_code in _InstrumentationStatusCodeCategories.SKIPPED:
-      tr_record.test_skip(
-        e=signals.TestSkip(details=details, extras=extras))
+      tr_record.test_skip(e=signals.TestSkip(details=details, extras=extras))
     elif self._status_code in _InstrumentationStatusCodeCategories.PASS:
-      tr_record.test_pass(
-        e=signals.TestPass(details=details, extras=extras))
+      tr_record.test_pass(e=signals.TestPass(details=details, extras=extras))
     elif self._status_code in _InstrumentationStatusCodeCategories.TIMING:
       if self._error_message:
         tr_record.test_error(
-          e=signals.TestError(details=details, extras=extras))
+            e=signals.TestError(details=details, extras=extras))
       else:
         tr_record = None
     else:
-      tr_record.test_error(
-        e=signals.TestError(details=details, extras=extras))
+      tr_record.test_error(e=signals.TestError(details=details, extras=extras))
     if self._known_keys[_InstrumentationKnownStatusKeys.STACK]:
       tr_record.termination_signal.stacktrace = self._known_keys[
-        _InstrumentationKnownStatusKeys.STACK]
+          _InstrumentationKnownStatusKeys.STACK]
     return tr_record
 
   def has_completed_result_block_format(self, error_message):
@@ -678,10 +670,10 @@
 
   DEFAULT_INSTRUMENTATION_OPTION_PREFIX = 'instrumentation_option_'
   DEFAULT_INSTRUMENTATION_ERROR_MESSAGE = ('instrumentation run exited '
-                       'unexpectedly')
+                                           'unexpectedly')
 
   def _previous_block_never_completed(self, current_block, previous_block,
-                    new_state):
+                                      new_state):
     """Checks if the previous instrumentation method block completed.
 
     Args:
@@ -699,12 +691,11 @@
       completed executing.
     """
     if previous_block:
-      previously_timing_block = (
-        previous_block.status_code in
-        _InstrumentationStatusCodeCategories.TIMING)
-      currently_new_block = (
-        current_block.status_code == _InstrumentationStatusCodes.START
-        or new_state == _InstrumentationBlockStates.RESULT)
+      previously_timing_block = (previous_block.status_code
+                                 in _InstrumentationStatusCodeCategories.TIMING)
+      currently_new_block = (current_block.status_code
+                             == _InstrumentationStatusCodes.START or
+                             new_state == _InstrumentationBlockStates.RESULT)
       return all([previously_timing_block, currently_new_block])
     else:
       return False
@@ -726,18 +717,16 @@
     formatters = []
     if self._previous_block_never_completed(
         current_block=instrumentation_block,
-        previous_block=instrumentation_block.
-        previous_instrumentation_block,
+        previous_block=instrumentation_block.previous_instrumentation_block,
         new_state=new_state):
       instrumentation_block.previous_instrumentation_block.set_error_message(
-        self.DEFAULT_INSTRUMENTATION_ERROR_MESSAGE)
+          self.DEFAULT_INSTRUMENTATION_ERROR_MESSAGE)
       formatters.append(
-        _InstrumentationBlockFormatter(
-          instrumentation_block.previous_instrumentation_block))
+          _InstrumentationBlockFormatter(
+              instrumentation_block.previous_instrumentation_block))
 
     if not instrumentation_block.is_empty:
-      formatters.append(
-        _InstrumentationBlockFormatter(instrumentation_block))
+      formatters.append(_InstrumentationBlockFormatter(instrumentation_block))
     return formatters
 
   def _transition_instrumentation_block(
@@ -762,7 +751,7 @@
       if test_record:
         self.results.add_record(test_record)
         self.summary_writer.dump(test_record.to_dict(),
-                     records.TestSummaryEntryType.RECORD)
+                                 records.TestSummaryEntryType.RECORD)
     return instrumentation_block.transition_state(new_state=new_state)
 
   def _parse_method_block_line(self, instrumentation_block, line):
@@ -778,23 +767,22 @@
       parsing instrumentation output.
     """
     if line.startswith(_InstrumentationStructurePrefixes.STATUS):
-      instrumentation_block.set_key(
-        _InstrumentationStructurePrefixes.STATUS, line)
+      instrumentation_block.set_key(_InstrumentationStructurePrefixes.STATUS,
+                                    line)
       return instrumentation_block
     elif line.startswith(_InstrumentationStructurePrefixes.STATUS_CODE):
       instrumentation_block.set_status_code(line)
-      return self._transition_instrumentation_block(
-        instrumentation_block)
+      return self._transition_instrumentation_block(instrumentation_block)
     elif line.startswith(_InstrumentationStructurePrefixes.RESULT):
       # Unexpected transition from method block -> result block
-      instrumentation_block.set_key(
-        _InstrumentationStructurePrefixes.RESULT, line)
+      instrumentation_block.set_key(_InstrumentationStructurePrefixes.RESULT,
+                                    line)
       return self._parse_result_line(
-        self._transition_instrumentation_block(
-          instrumentation_block,
-          new_state=_InstrumentationBlockStates.RESULT,
-        ),
-        line,
+          self._transition_instrumentation_block(
+              instrumentation_block,
+              new_state=_InstrumentationBlockStates.RESULT,
+          ),
+          line,
       )
     else:
       instrumentation_block.add_value(line)
@@ -834,20 +822,20 @@
     """
     if line.startswith(_InstrumentationStructurePrefixes.STATUS):
       return self._parse_method_block_line(
-        self._transition_instrumentation_block(
-          instrumentation_block,
-          new_state=_InstrumentationBlockStates.METHOD,
-        ),
-        line,
+          self._transition_instrumentation_block(
+              instrumentation_block,
+              new_state=_InstrumentationBlockStates.METHOD,
+          ),
+          line,
       )
-    elif (line.startswith(_InstrumentationStructurePrefixes.RESULT)
-        or _InstrumentationStructurePrefixes.FAILED in line):
+    elif (line.startswith(_InstrumentationStructurePrefixes.RESULT) or
+          _InstrumentationStructurePrefixes.FAILED in line):
       return self._parse_result_block_line(
-        self._transition_instrumentation_block(
-          instrumentation_block,
-          new_state=_InstrumentationBlockStates.RESULT,
-        ),
-        line,
+          self._transition_instrumentation_block(
+              instrumentation_block,
+              new_state=_InstrumentationBlockStates.RESULT,
+          ),
+          line,
       )
     else:
       # This would only really execute if instrumentation failed to start.
@@ -894,7 +882,7 @@
     """
     formatter = _InstrumentationBlockFormatter(instrumentation_block)
     return formatter.has_completed_result_block_format(
-      self.DEFAULT_INSTRUMENTATION_ERROR_MESSAGE)
+        self.DEFAULT_INSTRUMENTATION_ERROR_MESSAGE)
 
   def parse_instrumentation_options(self, parameters=None):
     """Returns the options for the instrumentation test from user_params.
@@ -915,19 +903,18 @@
 
     filtered_parameters = {}
     for parameter_key, parameter_value in parameters.items():
-      if parameter_key.startswith(
-          self.DEFAULT_INSTRUMENTATION_OPTION_PREFIX):
-        option_key = parameter_key[len(
-          self.DEFAULT_INSTRUMENTATION_OPTION_PREFIX):]
+      if parameter_key.startswith(self.DEFAULT_INSTRUMENTATION_OPTION_PREFIX):
+        option_key = parameter_key[len(self.
+                                       DEFAULT_INSTRUMENTATION_OPTION_PREFIX):]
         filtered_parameters[option_key] = parameter_value
     return filtered_parameters
 
   def run_instrumentation_test(self,
-                 device,
-                 package,
-                 options=None,
-                 prefix=None,
-                 runner=None):
+                               device,
+                               package,
+                               options=None,
+                               prefix=None,
+                               runner=None):
     """Runs instrumentation tests on a device and creates test records.
 
     Args:
@@ -955,19 +942,19 @@
     def parse_instrumentation(raw_line):
       line = raw_line.rstrip().decode('utf-8')
       logging.info(line)
-      instrumentation_block[0] = self._parse_line(
-        instrumentation_block[0], line)
+      instrumentation_block[0] = self._parse_line(instrumentation_block[0],
+                                                  line)
 
     device.adb.instrument(package=package,
-                options=options,
-                runner=runner,
-                handler=parse_instrumentation)
+                          options=options,
+                          runner=runner,
+                          handler=parse_instrumentation)
 
     return self._finish_parsing(instrumentation_block[0])
 
 
 class BaseInstrumentationTestClass(InstrumentationTestMixin,
-                   base_test.BaseTestClass):
+                                   base_test.BaseTestClass):
   """Base class for all instrumentation test classes to inherit from.
 
   This class extends the BaseTestClass to add functionality to run and parse
diff --git a/mobly/base_test.py b/mobly/base_test.py
index 9d30e60..5240f73 100644
--- a/mobly/base_test.py
+++ b/mobly/base_test.py
@@ -101,7 +101,7 @@
     class_identifier = self.__class__.__name__
     if configs.test_class_name_suffix:
       class_identifier = '%s_%s' % (class_identifier,
-                      configs.test_class_name_suffix)
+                                    configs.test_class_name_suffix)
     if self.TAG is None:
       self.TAG = class_identifier
     # Set params.
@@ -116,13 +116,13 @@
     self.summary_writer = configs.summary_writer
     self._generated_test_table = collections.OrderedDict()
     self._controller_manager = controller_manager.ControllerManager(
-      class_name=self.TAG, controller_configs=configs.controller_configs)
+        class_name=self.TAG, controller_configs=configs.controller_configs)
     self.controller_configs = self._controller_manager.controller_configs
 
   def unpack_userparams(self,
-              req_param_names=None,
-              opt_param_names=None,
-              **kwargs):
+                        req_param_names=None,
+                        opt_param_names=None,
+                        **kwargs):
     """An optional function that unpacks user defined parameters into
     individual variables.
 
@@ -160,7 +160,7 @@
         continue
       if name not in self.user_params:
         raise Error('Missing required user param "%s" in test '
-              'configuration.' % name)
+                    'configuration.' % name)
       setattr(self, name, self.user_params[name])
     for name in opt_param_names:
       if hasattr(self, name):
@@ -169,8 +169,8 @@
         setattr(self, name, self.user_params[name])
       else:
         logging.warning(
-          'Missing optional user param "%s" in '
-          'configuration, continue.', name)
+            'Missing optional user param "%s" in '
+            'configuration, continue.', name)
 
   def register_controller(self, module, required=True, min_number=1):
     """Loads a controller module and returns its loaded devices.
@@ -245,15 +245,15 @@
         * `required` is True and no corresponding config can be found.
         * Any other error occurred in the registration process.
     """
-    return self._controller_manager.register_controller(
-      module, required, min_number)
+    return self._controller_manager.register_controller(module, required,
+                                                        min_number)
 
   def _record_controller_info(self):
     # Collect controller information and write to test result.
     for record in self._controller_manager.get_controller_info_records():
       self.results.add_controller_info_record(record)
-      self.summary_writer.dump(
-        record.to_dict(), records.TestSummaryEntryType.CONTROLLER_INFO)
+      self.summary_writer.dump(record.to_dict(),
+                               records.TestSummaryEntryType.CONTROLLER_INFO)
 
   def _setup_generated_tests(self):
     """Proxy function to guarantee the base implementation of
@@ -266,7 +266,7 @@
     record = records.TestResultRecord(stage_name, self.TAG)
     record.test_begin()
     self.current_test_info = runtime_test_info.RuntimeTestInfo(
-      stage_name, self.log_path, record)
+        stage_name, self.log_path, record)
     try:
       with self._log_test_stage(stage_name):
         self.setup_generated_tests()
@@ -276,7 +276,7 @@
       record.test_error(e)
       self.results.add_class_error(record)
       self.summary_writer.dump(record.to_dict(),
-                   records.TestSummaryEntryType.RECORD)
+                               records.TestSummaryEntryType.RECORD)
       return False
 
   def setup_generated_tests(self):
@@ -299,11 +299,10 @@
       has gone wrong, and the rest of the test class should not execute.
     """
     # Setup for the class.
-    class_record = records.TestResultRecord(STAGE_NAME_SETUP_CLASS,
-                        self.TAG)
+    class_record = records.TestResultRecord(STAGE_NAME_SETUP_CLASS, self.TAG)
     class_record.test_begin()
     self.current_test_info = runtime_test_info.RuntimeTestInfo(
-      STAGE_NAME_SETUP_CLASS, self.log_path, class_record)
+        STAGE_NAME_SETUP_CLASS, self.log_path, class_record)
     expects.recorder.reset_internal_states(class_record)
     try:
       with self._log_test_stage(STAGE_NAME_SETUP_CLASS):
@@ -320,7 +319,7 @@
       self._exec_procedure_func(self._on_fail, class_record)
       class_record.update_record()
       self.summary_writer.dump(class_record.to_dict(),
-                   records.TestSummaryEntryType.RECORD)
+                               records.TestSummaryEntryType.RECORD)
       self._skip_remaining_tests(e)
       return self.results
     if expects.recorder.has_error:
@@ -328,10 +327,9 @@
       class_record.test_error()
       class_record.update_record()
       self.summary_writer.dump(class_record.to_dict(),
-                   records.TestSummaryEntryType.RECORD)
+                               records.TestSummaryEntryType.RECORD)
       self.results.add_class_error(class_record)
-      self._skip_remaining_tests(
-        class_record.termination_signal.exception)
+      self._skip_remaining_tests(class_record.termination_signal.exception)
       return self.results
 
   def setup_class(self):
@@ -353,7 +351,7 @@
     record = records.TestResultRecord(stage_name, self.TAG)
     record.test_begin()
     self.current_test_info = runtime_test_info.RuntimeTestInfo(
-      stage_name, self.log_path, record)
+        stage_name, self.log_path, record)
     expects.recorder.reset_internal_states(record)
     try:
       with self._log_test_stage(stage_name):
@@ -367,13 +365,13 @@
       record.update_record()
       self.results.add_class_error(record)
       self.summary_writer.dump(record.to_dict(),
-                   records.TestSummaryEntryType.RECORD)
+                               records.TestSummaryEntryType.RECORD)
     else:
       if expects.recorder.has_error:
         record.update_record()
         self.results.add_class_error(record)
         self.summary_writer.dump(record.to_dict(),
-                     records.TestSummaryEntryType.RECORD)
+                                 records.TestSummaryEntryType.RECORD)
     finally:
       self._clean_up()
 
@@ -403,14 +401,14 @@
     if parent_token == stage_name:
       parent_token = self.TAG
     logging.debug(
-      TEST_STAGE_BEGIN_LOG_TEMPLATE.format(parent_token=parent_token,
-                         child_token=stage_name))
+        TEST_STAGE_BEGIN_LOG_TEMPLATE.format(parent_token=parent_token,
+                                             child_token=stage_name))
     try:
       yield
     finally:
       logging.debug(
-        TEST_STAGE_END_LOG_TEMPLATE.format(parent_token=parent_token,
-                           child_token=stage_name))
+          TEST_STAGE_END_LOG_TEMPLATE.format(parent_token=parent_token,
+                                             child_token=stage_name))
 
   def _setup_test(self, test_name):
     """Proxy function to guarantee the base implementation of setup_test is
@@ -539,9 +537,8 @@
       except signals.TestAbortSignal:
         raise
       except Exception as e:
-        logging.exception(
-          'Exception happened when executing %s for %s.',
-          procedure_name, self.current_test_info.name)
+        logging.exception('Exception happened when executing %s for %s.',
+                          procedure_name, self.current_test_info.name)
         tr_record.add_error(procedure_name, e)
 
   def record_data(self, content):
@@ -561,8 +558,7 @@
     """
     if 'timestamp' not in content:
       content['timestamp'] = utils.get_current_epoch_time()
-    self.summary_writer.dump(content,
-                 records.TestSummaryEntryType.USER_DATA)
+    self.summary_writer.dump(content, records.TestSummaryEntryType.USER_DATA)
 
   def exec_one_test(self, test_name, test_method):
     """Executes one test and update test results.
@@ -579,7 +575,7 @@
     tr_record.uid = getattr(test_method, 'uid', None)
     tr_record.test_begin()
     self.current_test_info = runtime_test_info.RuntimeTestInfo(
-      test_name, self.log_path, tr_record)
+        test_name, self.log_path, tr_record)
     expects.recorder.reset_internal_states(tr_record)
     logging.info('%s %s', TEST_CASE_TOKEN, test_name)
     # Did teardown_test throw an error.
@@ -589,14 +585,13 @@
         try:
           self._setup_test(test_name)
         except signals.TestFailure as e:
-          raise_with_traceback(signals.TestError(
-            e.details, e.extras))
+          raise_with_traceback(signals.TestError(e.details, e.extras))
         test_method()
       except (signals.TestPass, signals.TestAbortSignal):
         raise
       except Exception:
         logging.exception('Exception occurred in %s.',
-                  self.current_test_info.name)
+                          self.current_test_info.name)
         raise
       finally:
         before_count = expects.recorder.error_count
@@ -641,9 +636,8 @@
     finally:
       tr_record.update_record()
       try:
-        if tr_record.result in (
-            records.TestResultEnums.TEST_RESULT_ERROR,
-            records.TestResultEnums.TEST_RESULT_FAIL):
+        if tr_record.result in (records.TestResultEnums.TEST_RESULT_ERROR,
+                                records.TestResultEnums.TEST_RESULT_FAIL):
           self._exec_procedure_func(self._on_fail, tr_record)
         elif tr_record.result == records.TestResultEnums.TEST_RESULT_PASS:
           self._exec_procedure_func(self._on_pass, tr_record)
@@ -651,10 +645,10 @@
           self._exec_procedure_func(self._on_skip, tr_record)
       finally:
         logging.info(RESULT_LINE_TEMPLATE, tr_record.test_name,
-               tr_record.result)
+                     tr_record.result)
         self.results.add_record(tr_record)
         self.summary_writer.dump(tr_record.to_dict(),
-                     records.TestSummaryEntryType.RECORD)
+                                 records.TestSummaryEntryType.RECORD)
         self.current_test_info = None
 
   def _assert_function_name_in_stack(self, expected_func_name):
@@ -665,7 +659,7 @@
       if caller_frame[3] == expected_func_name:
         return
     raise Error('"%s" cannot be called outside of %s' %
-          (caller_frames[1][3], expected_func_name))
+                (caller_frames[1][3], expected_func_name))
 
   def generate_tests(self, test_logic, name_func, arg_sets, uid_func=None):
     """Generates tests in the test class.
@@ -697,15 +691,13 @@
     for args in arg_sets:
       test_name = name_func(*args)
       if test_name in self.get_existing_test_names():
-        raise Error(
-          '%s Test name "%s" already exists, cannot be duplicated!' %
-          (root_msg, test_name))
+        raise Error('%s Test name "%s" already exists, cannot be duplicated!' %
+                    (root_msg, test_name))
       test_func = functools.partial(test_logic, *args)
       if uid_func is not None:
         uid = uid_func(*args)
         if uid is None:
-          logging.warning('%s UID for arg set %s is None.', root_msg,
-                  args)
+          logging.warning('%s UID for arg set %s is None.', root_msg, args)
         else:
           setattr(test_func, 'uid', uid)
       self._generated_test_table[test_name] = test_func
@@ -729,7 +721,7 @@
       raise
     except:
       logging.exception('Exception happened when executing %s in %s.',
-                func.__name__, self.TAG)
+                        func.__name__, self.TAG)
 
   def get_existing_test_names(self):
     """Gets the names of existing tests in the class.
@@ -768,14 +760,13 @@
     for test_name in test_names:
       if not test_name.startswith('test_'):
         raise Error('Test method name %s does not follow naming '
-              'convention test_*, abort.' % test_name)
+                    'convention test_*, abort.' % test_name)
       if hasattr(self, test_name):
         test_method = getattr(self, test_name)
       elif test_name in self._generated_test_table:
         test_method = self._generated_test_table[test_name]
       else:
-        raise Error('%s does not have test method %s.' %
-              (self.TAG, test_name))
+        raise Error('%s does not have test method %s.' % (self.TAG, test_name))
       test_methods.append((test_name, test_method))
     return test_methods
 
@@ -795,7 +786,7 @@
         test_record.test_skip(exception)
         self.results.add_record(test_record)
         self.summary_writer.dump(test_record.to_dict(),
-                     records.TestSummaryEntryType.RECORD)
+                                 records.TestSummaryEntryType.RECORD)
 
   def run(self, test_names=None):
     """Runs tests within a test class.
@@ -832,7 +823,7 @@
         test_names = self.get_existing_test_names()
     self.results.requested = test_names
     self.summary_writer.dump(self.results.requested_test_names_dict(),
-                 records.TestSummaryEntryType.TEST_NAME_LIST)
+                             records.TestSummaryEntryType.TEST_NAME_LIST)
     tests = self._get_test_methods(test_names)
     try:
       setup_class_result = self._setup_class()
@@ -856,7 +847,7 @@
     finally:
       self._teardown_class()
       logging.info('Summary for test class %s: %s', self.TAG,
-             self.results.summary_str())
+                   self.results.summary_str())
 
   def _clean_up(self):
     """The final stage of a test class execution."""
@@ -864,7 +855,7 @@
     record = records.TestResultRecord(stage_name, self.TAG)
     record.test_begin()
     self.current_test_info = runtime_test_info.RuntimeTestInfo(
-      stage_name, self.log_path, record)
+        stage_name, self.log_path, record)
     expects.recorder.reset_internal_states(record)
     with self._log_test_stage(stage_name):
       # Write controller info and summary to summary file.
@@ -875,4 +866,4 @@
         record.update_record()
         self.results.add_class_error(record)
         self.summary_writer.dump(record.to_dict(),
-                     records.TestSummaryEntryType.RECORD)
+                                 records.TestSummaryEntryType.RECORD)
diff --git a/mobly/config_parser.py b/mobly/config_parser.py
index 477cb3d..8a8d2bd 100644
--- a/mobly/config_parser.py
+++ b/mobly/config_parser.py
@@ -40,7 +40,7 @@
   required_key = keys.Config.key_testbed.value
   if required_key not in test_config:
     raise MoblyConfigError('Required key %s missing in test config.' %
-                 required_key)
+                           required_key)
 
 
 def _validate_testbed_name(name):
@@ -60,8 +60,8 @@
   name = str(name)
   for char in name:
     if char not in utils.valid_filename_chars:
-      raise MoblyConfigError(
-        'Char "%s" is not allowed in test bed names.' % char)
+      raise MoblyConfigError('Char "%s" is not allowed in test bed names.' %
+                             char)
 
 
 def _validate_testbed_configs(testbed_configs):
@@ -110,14 +110,12 @@
         tbs.append(tb)
     if len(tbs) != len(tb_filters):
       raise MoblyConfigError(
-        'Expect to find %d test bed configs, found %d. Check if'
-        ' you have the correct test bed names.' %
-        (len(tb_filters), len(tbs)))
+          'Expect to find %d test bed configs, found %d. Check if'
+          ' you have the correct test bed names.' % (len(tb_filters), len(tbs)))
     configs[keys.Config.key_testbed.value] = tbs
   mobly_params = configs.get(keys.Config.key_mobly_params.value, {})
   # Decide log path.
-  log_path = mobly_params.get(keys.Config.key_log_path.value,
-                _DEFAULT_LOG_PATH)
+  log_path = mobly_params.get(keys.Config.key_log_path.value, _DEFAULT_LOG_PATH)
   if ENV_MOBLY_LOGPATH in os.environ:
     log_path = os.environ[ENV_MOBLY_LOGPATH]
   log_path = utils.abs_path(log_path)
@@ -129,14 +127,14 @@
   for original_bed_config in configs[keys.Config.key_testbed.value]:
     test_run_config = TestRunConfig()
     test_run_config.testbed_name = original_bed_config[
-      keys.Config.key_testbed_name.value]
+        keys.Config.key_testbed_name.value]
     # Deprecated, use testbed_name
     test_run_config.test_bed_name = test_run_config.testbed_name
     test_run_config.log_path = log_path
     test_run_config.controller_configs = original_bed_config.get(
-      keys.Config.key_testbed_controllers.value, {})
+        keys.Config.key_testbed_controllers.value, {})
     test_run_config.user_params = original_bed_config.get(
-      keys.Config.key_testbed_test_params.value, {})
+        keys.Config.key_testbed_test_params.value, {})
     test_configs.append(test_run_config)
   return test_configs
 
diff --git a/mobly/controller_manager.py b/mobly/controller_manager.py
index 2325d27..147e320 100644
--- a/mobly/controller_manager.py
+++ b/mobly/controller_manager.py
@@ -41,12 +41,12 @@
   for attr in required_attributes:
     if not hasattr(module, attr):
       raise signals.ControllerError(
-        'Module %s missing required controller module attribute'
-        ' %s.' % (module.__name__, attr))
+          'Module %s missing required controller module attribute'
+          ' %s.' % (module.__name__, attr))
     if not getattr(module, attr):
       raise signals.ControllerError(
-        'Controller interface %s in %s cannot be null.' %
-        (attr, module.__name__))
+          'Controller interface %s in %s cannot be null.' %
+          (attr, module.__name__))
 
 
 class ControllerManager(object):
@@ -101,18 +101,17 @@
     module_ref_name = module.__name__.split('.')[-1]
     if module_ref_name in self._controller_objects:
       raise signals.ControllerError(
-        'Controller module %s has already been registered. It cannot '
-        'be registered again.' % module_ref_name)
+          'Controller module %s has already been registered. It cannot '
+          'be registered again.' % module_ref_name)
     # Create controller objects.
     module_config_name = module.MOBLY_CONTROLLER_CONFIG_NAME
     if module_config_name not in self.controller_configs:
       if required:
-        raise signals.ControllerError(
-          'No corresponding config found for %s' %
-          module_config_name)
+        raise signals.ControllerError('No corresponding config found for %s' %
+                                      module_config_name)
       logging.warning(
-        'No corresponding config found for optional controller %s',
-        module_config_name)
+          'No corresponding config found for optional controller %s',
+          module_config_name)
       return None
     try:
       # Make a deep copy of the config to pass to the controller module,
@@ -122,25 +121,25 @@
       objects = module.create(controller_config)
     except:
       logging.exception(
-        'Failed to initialize objects for controller %s, abort!',
-        module_config_name)
+          'Failed to initialize objects for controller %s, abort!',
+          module_config_name)
       raise
     if not isinstance(objects, list):
       raise signals.ControllerError(
-        'Controller module %s did not return a list of objects, abort.'
-        % module_ref_name)
+          'Controller module %s did not return a list of objects, abort.' %
+          module_ref_name)
     # Check we got enough controller objects to continue.
     actual_number = len(objects)
     if actual_number < min_number:
       module.destroy(objects)
       raise signals.ControllerError(
-        'Expected to get at least %d controller objects, got %d.' %
-        (min_number, actual_number))
+          'Expected to get at least %d controller objects, got %d.' %
+          (min_number, actual_number))
     # Save a shallow copy of the list for internal usage, so tests can't
     # affect internal registry by manipulating the object list.
     self._controller_objects[module_ref_name] = copy.copy(objects)
     logging.debug('Found %d objects for controller %s', len(objects),
-            module_config_name)
+                  module_config_name)
     self._controller_modules[module_ref_name] = module
     return objects
 
@@ -153,8 +152,7 @@
     # logging them.
     for name, module in self._controller_modules.items():
       logging.debug('Destroying %s.', name)
-      with expects.expect_no_raises('Exception occurred destroying %s.' %
-                      name):
+      with expects.expect_no_raises('Exception occurred destroying %s.' % name):
         module.destroy(self._controller_objects[name])
     self._controller_objects = collections.OrderedDict()
     self._controller_modules = {}
@@ -176,23 +174,22 @@
     controller_info = None
     try:
       controller_info = module.get_info(
-        copy.copy(self._controller_objects[controller_module_name]))
+          copy.copy(self._controller_objects[controller_module_name]))
     except AttributeError:
       logging.warning(
-        'No optional debug info found for controller '
-        '%s. To provide it, implement `get_info`.',
-        controller_module_name)
+          'No optional debug info found for controller '
+          '%s. To provide it, implement `get_info`.', controller_module_name)
     try:
       yaml.dump(controller_info)
     except TypeError:
       logging.warning(
-        'The info of controller %s in class "%s" is not '
-        'YAML serializable! Coercing it to string.',
-        controller_module_name, self._class_name)
+          'The info of controller %s in class "%s" is not '
+          'YAML serializable! Coercing it to string.', controller_module_name,
+          self._class_name)
       controller_info = str(controller_info)
-    return records.ControllerInfoRecord(
-      self._class_name, module.MOBLY_CONTROLLER_CONFIG_NAME,
-      controller_info)
+    return records.ControllerInfoRecord(self._class_name,
+                                        module.MOBLY_CONTROLLER_CONFIG_NAME,
+                                        controller_info)
 
   def get_controller_info_records(self):
     """Get the info records for all the controller objects in the manager.
@@ -207,10 +204,8 @@
     info_records = []
     for controller_module_name in self._controller_objects.keys():
       with expects.expect_no_raises(
-          'Failed to collect controller info from %s' %
-          controller_module_name):
-        record = self._create_controller_info_record(
-          controller_module_name)
+          'Failed to collect controller info from %s' % controller_module_name):
+        record = self._create_controller_info_record(controller_module_name)
         if record:
           info_records.append(record)
     return info_records
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py
index 5a6dcb0..51aa210 100644
--- a/mobly/controllers/android_device.py
+++ b/mobly/controllers/android_device.py
@@ -46,15 +46,15 @@
 # System properties that are cached by the `AndroidDevice.build_info` property.
 # The only properties on this list should be read-only system properties.
 CACHED_SYSTEM_PROPS = [
-  'ro.build.id',
-  'ro.build.type',
-  'ro.build.version.codename',
-  'ro.build.version.sdk',
-  'ro.build.product',
-  'ro.build.characteristics',
-  'ro.debuggable',
-  'ro.product.name',
-  'ro.hardware',
+    'ro.build.id',
+    'ro.build.type',
+    'ro.build.version.codename',
+    'ro.build.version.sdk',
+    'ro.build.product',
+    'ro.build.characteristics',
+    'ro.debuggable',
+    'ro.product.name',
+    'ro.hardware',
 ]
 
 # Keys for attributes in configs that alternate the controller module behavior.
@@ -115,8 +115,8 @@
   for ad in ads:
     if ad.serial not in valid_ad_identifiers:
       raise DeviceError(
-        ad, 'Android device is specified in config but is not '
-        'attached.')
+          ad, 'Android device is specified in config but is not '
+          'attached.')
   _start_services_on_ads(ads)
   return ads
 
@@ -156,21 +156,20 @@
     ads: A list of AndroidDevice objects whose services to start.
   """
   for ad in ads:
-    start_logcat = not getattr(ad, KEY_SKIP_LOGCAT,
-                   DEFAULT_VALUE_SKIP_LOGCAT)
+    start_logcat = not getattr(ad, KEY_SKIP_LOGCAT, DEFAULT_VALUE_SKIP_LOGCAT)
     try:
       if start_logcat:
         ad.services.logcat.start()
     except Exception:
       is_required = getattr(ad, KEY_DEVICE_REQUIRED,
-                  DEFAULT_VALUE_DEVICE_REQUIRED)
+                            DEFAULT_VALUE_DEVICE_REQUIRED)
       if is_required:
         ad.log.exception('Failed to start some services, abort!')
         destroy(ads)
         raise
       else:
         ad.log.exception('Skipping this optional device because some '
-                 'services failed to start.')
+                         'services failed to start.')
 
 
 def parse_device_list(device_list_str, key):
@@ -272,8 +271,7 @@
       serial = c.pop('serial')
     except KeyError:
       raise Error(
-        'Required value "serial" is missing in AndroidDevice config %s.'
-        % c)
+          'Required value "serial" is missing in AndroidDevice config %s.' % c)
     is_required = c.get(KEY_DEVICE_REQUIRED, True)
     try:
       ad = AndroidDevice(serial)
@@ -351,9 +349,8 @@
 
   filtered = filter_devices(ads, _get_device_filter)
   if not filtered:
-    raise Error(
-      'Could not find a target device that matches condition: %s.' %
-      kwargs)
+    raise Error('Could not find a target device that matches condition: %s.' %
+                kwargs)
   else:
     return filtered
 
@@ -409,8 +406,8 @@
 
   def take_br(test_name, begin_time, ad, destination):
     ad.take_bug_report(test_name=test_name,
-               begin_time=begin_time,
-               destination=destination)
+                       begin_time=begin_time,
+                       destination=destination)
 
   args = [(test_name, begin_time, ad, destination) for ad in ads]
   utils.concurrent_exec(take_br, args)
@@ -447,11 +444,11 @@
     self._serial = str(serial)
     # logging.log_path only exists when this is used in an Mobly test run.
     self._log_path_base = getattr(logging, 'log_path', '/tmp/logs')
-    self._log_path = os.path.join(
-      self._log_path_base, 'AndroidDevice%s' % self._normalized_serial)
+    self._log_path = os.path.join(self._log_path_base,
+                                  'AndroidDevice%s' % self._normalized_serial)
     self._debug_tag = self._serial
     self.log = AndroidDeviceLoggerAdapter(logging.getLogger(),
-                        {'tag': self.debug_tag})
+                                          {'tag': self.debug_tag})
     self._build_info = None
     self._is_rebooting = False
     self.adb = adb.AdbProxy(serial)
@@ -460,10 +457,10 @@
       self.root_adb()
     self.services = service_manager.ServiceManager(self)
     self.services.register(SERVICE_NAME_LOGCAT,
-                 logcat.Logcat,
-                 start_service=False)
-    self.services.register(
-      'snippets', snippet_management_service.SnippetManagementService)
+                           logcat.Logcat,
+                           start_service=False)
+    self.services.register('snippets',
+                           snippet_management_service.SnippetManagementService)
     # Device info cache.
     self._user_added_device_info = {}
 
@@ -494,10 +491,10 @@
     can be added via `add_device_info`.
     """
     info = {
-      'serial': self.serial,
-      'model': self.model,
-      'build_info': self.build_info,
-      'user_added_info': self._user_added_device_info
+        'serial': self.serial,
+        'model': self.model,
+        'build_info': self.build_info,
+        'user_added_info': self._user_added_device_info
     }
     return info
 
@@ -583,14 +580,13 @@
     """Setter for `log_path`, use with caution."""
     if self.has_active_service:
       raise DeviceError(
-        self,
-        'Cannot change `log_path` when there is service running.')
+          self, 'Cannot change `log_path` when there is service running.')
     old_path = self._log_path
     if new_path == old_path:
       return
     if os.listdir(new_path):
-      raise DeviceError(
-        self, 'Logs already exist at %s, cannot override.' % new_path)
+      raise DeviceError(self,
+                        'Logs already exist at %s, cannot override.' % new_path)
     if os.path.exists(old_path):
       # Remove new path so copytree doesn't complain.
       shutil.rmtree(new_path, ignore_errors=True)
@@ -633,9 +629,8 @@
     new_serial = str(new_serial)
     if self.has_active_service:
       raise DeviceError(
-        self,
-        'Cannot change device serial number when there is service running.'
-      )
+          self,
+          'Cannot change device serial number when there is service running.')
     if self._debug_tag == self.serial:
       self._debug_tag = new_serial
     self._serial = new_serial
@@ -749,8 +744,7 @@
       device is in bootloader mode.
     """
     if self.is_bootloader:
-      self.log.error('Device is in fastboot mode, could not get build '
-               'info.')
+      self.log.error('Device is in fastboot mode, could not get build ' 'info.')
       return
     if self._build_info is None or self._is_rebooting:
       info = {}
@@ -758,12 +752,11 @@
       info['build_id'] = build_info['ro.build.id']
       info['build_type'] = build_info['ro.build.type']
       info['build_version_codename'] = build_info.get(
-        'ro.build.version.codename', '')
-      info['build_version_sdk'] = build_info.get('ro.build.version.sdk',
-                             '')
+          'ro.build.version.codename', '')
+      info['build_version_sdk'] = build_info.get('ro.build.version.sdk', '')
       info['build_product'] = build_info.get('ro.build.product', '')
-      info['build_characteristics'] = build_info.get(
-        'ro.build.characteristics', '')
+      info['build_characteristics'] = build_info.get('ro.build.characteristics',
+                                                     '')
       info['debuggable'] = build_info.get('ro.debuggable', '')
       info['product_name'] = build_info.get('ro.product.name', '')
       info['hardware'] = build_info.get('ro.hardware', '')
@@ -849,9 +842,8 @@
     for k, v in config.items():
       if hasattr(self, k) and k not in _ANDROID_DEVICE_SETTABLE_PROPS:
         raise DeviceError(
-          self,
-          ('Attribute %s already exists with value %s, cannot set '
-           'again.') % (k, getattr(self, k)))
+            self, ('Attribute %s already exists with value %s, cannot set '
+                   'again.') % (k, getattr(self, k)))
       setattr(self, k, v)
 
   def root_adb(self):
@@ -863,8 +855,7 @@
     self.adb.root()
     # `root` causes the device to temporarily disappear from adb.
     # So we need to wait for the device to come back before proceeding.
-    self.adb.wait_for_device(
-      timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND)
+    self.adb.wait_for_device(timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND)
 
   def load_snippet(self, name, package):
     """Starts the snippet apk with the given package name and connects.
@@ -889,9 +880,8 @@
     # Should not load snippet with an existing attribute.
     if hasattr(self, name):
       raise SnippetError(
-        self,
-        'Attribute "%s" already exists, please use a different name.' %
-        name)
+          self,
+          'Attribute "%s" already exists, please use a different name.' % name)
     self.services.snippets.add_snippet_client(name, package)
 
   def unload_snippet(self, name):
@@ -906,9 +896,9 @@
     self.services.snippets.remove_snippet_client(name)
 
   def generate_filename(self,
-              file_type,
-              time_identifier=None,
-              extension_name=None):
+                        file_type,
+                        time_identifier=None,
+                        extension_name=None):
     """Generates a name for an output file related to this device.
 
     The name follows the pattern:
@@ -946,10 +936,10 @@
     return filename_str
 
   def take_bug_report(self,
-            test_name=None,
-            begin_time=None,
-            timeout=300,
-            destination=None):
+                      test_name=None,
+                      begin_time=None,
+                      timeout=300,
+                      destination=None):
     """Takes a bug report on the device and stores it in a file.
 
     Args:
@@ -1001,9 +991,7 @@
     else:
       # shell=True as this command redirects the stdout to a local file
       # using shell redirection.
-      self.adb.bugreport(' > "%s"' % full_out_path,
-                 shell=True,
-                 timeout=timeout)
+      self.adb.bugreport(' > "%s"' % full_out_path, shell=True, timeout=timeout)
     self.log.debug('Bugreport taken at %s.', full_out_path)
     return full_out_path
 
@@ -1019,7 +1007,7 @@
     filename = self.generate_filename('screenshot', extension_name='png')
     device_path = os.path.join('/storage/emulated/0/', filename)
     self.adb.shell(['screencap', '-p', device_path],
-             timeout=TAKE_SCREENSHOT_TIMEOUT_SECOND)
+                   timeout=TAKE_SCREENSHOT_TIMEOUT_SECOND)
     utils.create_dir(destination)
     self.adb.pull([device_path, destination])
     pic_path = os.path.join(destination, filename)
@@ -1048,8 +1036,8 @@
       return False, clean_out
     return True, clean_out
 
-  def wait_for_boot_completion(
-      self, timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND):
+  def wait_for_boot_completion(self,
+                               timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND):
     """Waits for Android framework to broadcast ACTION_BOOT_COMPLETED.
 
     This function times out after 15 minutes.
diff --git a/mobly/controllers/android_device_lib/adb.py b/mobly/controllers/android_device_lib/adb.py
index 43a4daa..1814d19 100644
--- a/mobly/controllers/android_device_lib/adb.py
+++ b/mobly/controllers/android_device_lib/adb.py
@@ -67,9 +67,9 @@
     self.serial = serial
 
   def __str__(self):
-    return ('Error executing adb cmd "%s". ret: %d, stdout: %s, stderr: %s'
-        ) % (utils.cli_cmd_to_string(
-          self.cmd), self.ret_code, self.stdout, self.stderr)
+    return ('Error executing adb cmd "%s". ret: %d, stdout: %s, stderr: %s') % (
+        utils.cli_cmd_to_string(
+            self.cmd), self.ret_code, self.stdout, self.stderr)
 
 
 class AdbTimeoutError(Error):
@@ -90,7 +90,7 @@
 
   def __str__(self):
     return 'Timed out executing command "%s" after %ss.' % (
-      utils.cli_cmd_to_string(self.cmd), self.timeout)
+        utils.cli_cmd_to_string(self.cmd), self.timeout)
 
 
 def list_occupied_adb_ports():
@@ -165,26 +165,22 @@
     if timeout and timeout <= 0:
       raise ValueError('Timeout is not a positive value: %s' % timeout)
     try:
-      (ret, out, err) = utils.run_command(args,
-                        shell=shell,
-                        timeout=timeout)
+      (ret, out, err) = utils.run_command(args, shell=shell, timeout=timeout)
     except psutil.TimeoutExpired:
-      raise AdbTimeoutError(cmd=args,
-                  timeout=timeout,
-                  serial=self.serial)
+      raise AdbTimeoutError(cmd=args, timeout=timeout, serial=self.serial)
 
     if stderr:
       stderr.write(err)
     logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s',
-            utils.cli_cmd_to_string(args), out, err, ret)
+                  utils.cli_cmd_to_string(args), out, err, ret)
     if ret == 0:
       return out
     else:
       raise AdbError(cmd=args,
-               stdout=out,
-               stderr=err,
-               ret_code=ret,
-               serial=self.serial)
+                     stdout=out,
+                     stderr=err,
+                     ret_code=ret,
+                     serial=self.serial)
 
   def _execute_and_process_stdout(self, args, shell, handler):
     """Executes adb commands and processes the stdout with a handler.
@@ -203,10 +199,10 @@
       AdbError: The adb command exit code is not 0.
     """
     proc = subprocess.Popen(args,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
-                shell=shell,
-                bufsize=1)
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE,
+                            shell=shell,
+                            bufsize=1)
     out = '[elided, processed via handler]'
     try:
       # Even if the process dies, stdout.readline still works
@@ -227,7 +223,7 @@
 
     ret = proc.returncode
     logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s',
-            utils.cli_cmd_to_string(args), out, err, ret)
+                  utils.cli_cmd_to_string(args), out, err, ret)
     if ret == 0:
       return err
     else:
@@ -273,17 +269,14 @@
 
   def _exec_adb_cmd(self, name, args, shell, timeout, stderr):
     adb_cmd = self._construct_adb_cmd(name, args, shell=shell)
-    out = self._exec_cmd(adb_cmd,
-               shell=shell,
-               timeout=timeout,
-               stderr=stderr)
+    out = self._exec_cmd(adb_cmd, shell=shell, timeout=timeout, stderr=stderr)
     return out
 
   def _execute_adb_and_process_stdout(self, name, args, shell, handler):
     adb_cmd = self._construct_adb_cmd(name, args, shell=shell)
     err = self._execute_and_process_stdout(adb_cmd,
-                         shell=shell,
-                         handler=handler)
+                                           shell=shell,
+                                           handler=handler)
     return err
 
   def _parse_getprop_output(self, output):
@@ -345,8 +338,8 @@
       doesn't exist.
     """
     return self.shell(
-      ['getprop', prop_name],
-      timeout=DEFAULT_GETPROP_TIMEOUT_SEC).decode('utf-8').strip()
+        ['getprop', prop_name],
+        timeout=DEFAULT_GETPROP_TIMEOUT_SEC).decode('utf-8').strip()
 
   def getprops(self, prop_names):
     """Get multiple properties of the device.
@@ -367,8 +360,7 @@
       # The ADB getprop command can randomly return empty string, so try
       # multiple times. This value should always be non-empty if the device
       # in a working state.
-      raw_output = self.shell(['getprop'],
-                  timeout=DEFAULT_GETPROP_TIMEOUT_SEC)
+      raw_output = self.shell(['getprop'], timeout=DEFAULT_GETPROP_TIMEOUT_SEC)
       properties = self._parse_getprop_output(raw_output)
       if properties:
         for name in prop_names:
@@ -390,8 +382,7 @@
       A boolean that is True if the command exists and False otherwise.
     """
     try:
-      output = self.shell(['command', '-v',
-                 command]).decode('utf-8').strip()
+      output = self.shell(['command', '-v', command]).decode('utf-8').strip()
       return command in output
     except AdbError:
       # If the command doesn't exist, then 'command -v' can return
@@ -401,10 +392,10 @@
   def forward(self, args=None, shell=False):
     with ADB_PORT_LOCK:
       return self._exec_adb_cmd('forward',
-                    args,
-                    shell,
-                    timeout=None,
-                    stderr=None)
+                                args,
+                                shell,
+                                timeout=None,
+                                stderr=None)
 
   def instrument(self, package, options=None, runner=None, handler=None):
     """Runs an instrumentation command on the device.
@@ -447,19 +438,21 @@
       options_list.append('-e %s %s' % (option_key, option_value))
     options_string = ' '.join(options_list)
 
-    instrumentation_command = 'am instrument -r -w %s %s/%s' % (
-      options_string, package, runner)
+    instrumentation_command = 'am instrument -r -w %s %s/%s' % (options_string,
+                                                                package, runner)
     logging.info('AndroidDevice|%s: Executing adb shell %s', self.serial,
-           instrumentation_command)
+                 instrumentation_command)
     if handler is None:
       return self._exec_adb_cmd('shell',
-                    instrumentation_command,
-                    shell=False,
-                    timeout=None,
-                    stderr=None)
+                                instrumentation_command,
+                                shell=False,
+                                timeout=None,
+                                stderr=None)
     else:
-      return self._execute_adb_and_process_stdout(
-        'shell', instrumentation_command, shell=False, handler=handler)
+      return self._execute_adb_and_process_stdout('shell',
+                                                  instrumentation_command,
+                                                  shell=False,
+                                                  handler=handler)
 
   def root(self):
     """Enables ADB root mode on the device.
@@ -478,22 +471,22 @@
     for attempt in range(ADB_ROOT_RETRY_ATTMEPTS):
       try:
         return self._exec_adb_cmd('root',
-                      args=None,
-                      shell=False,
-                      timeout=None,
-                      stderr=None)
+                                  args=None,
+                                  shell=False,
+                                  timeout=None,
+                                  stderr=None)
       except AdbError as e:
         if attempt + 1 < ADB_ROOT_RETRY_ATTMEPTS:
-          logging.debug(
-            'Retry the command "%s" since Error "%s" occurred.' %
-            (utils.cli_cmd_to_string(e.cmd),
-             e.stderr.decode('utf-8').strip()))
+          logging.debug('Retry the command "%s" since Error "%s" occurred.' %
+                        (utils.cli_cmd_to_string(
+                            e.cmd), e.stderr.decode('utf-8').strip()))
           # Buffer between "adb root" commands.
           time.sleep(ADB_ROOT_RETRY_ATTEMPT_INTERVAL_SEC)
         else:
           raise e
 
   def __getattr__(self, name):
+
     def adb_call(args=None, shell=False, timeout=None, stderr=None):
       """Wrapper for an ADB command.
 
@@ -511,9 +504,9 @@
         The output of the adb command run if exit code is 0.
       """
       return self._exec_adb_cmd(name,
-                    args,
-                    shell=shell,
-                    timeout=timeout,
-                    stderr=stderr)
+                                args,
+                                shell=shell,
+                                timeout=timeout,
+                                stderr=stderr)
 
     return adb_call
diff --git a/mobly/controllers/android_device_lib/callback_handler.py b/mobly/controllers/android_device_lib/callback_handler.py
index 8eb0869..ccfbec0 100644
--- a/mobly/controllers/android_device_lib/callback_handler.py
+++ b/mobly/controllers/android_device_lib/callback_handler.py
@@ -88,21 +88,18 @@
     if timeout:
       if timeout > MAX_TIMEOUT:
         raise Error(
-          self._ad,
-          'Specified timeout %s is longer than max timeout %s.' %
-          (timeout, MAX_TIMEOUT))
+            self._ad, 'Specified timeout %s is longer than max timeout %s.' %
+            (timeout, MAX_TIMEOUT))
     # Convert to milliseconds for java side.
     timeout_ms = int(timeout * 1000)
     try:
-      raw_event = self._event_client.eventWaitAndGet(
-        self._id, event_name, timeout_ms)
+      raw_event = self._event_client.eventWaitAndGet(self._id, event_name,
+                                                     timeout_ms)
     except Exception as e:
       if 'EventSnippetException: timeout.' in str(e):
         raise TimeoutError(
-          self._ad,
-          'Timed out after waiting %ss for event "%s" triggered by'
-          ' %s (%s).' %
-          (timeout, event_name, self._method_name, self._id))
+            self._ad, 'Timed out after waiting %ss for event "%s" triggered by'
+            ' %s (%s).' % (timeout, event_name, self._method_name, self._id))
       raise
     return snippet_event.from_dict(raw_event)
 
@@ -150,9 +147,9 @@
       if predicate(event):
         return event
     raise TimeoutError(
-      self._ad,
-      'Timed out after %ss waiting for an "%s" event that satisfies the '
-      'predicate "%s".' % (timeout, event_name, predicate.__name__))
+        self._ad,
+        'Timed out after %ss waiting for an "%s" event that satisfies the '
+        'predicate "%s".' % (timeout, event_name, predicate.__name__))
 
   def getAll(self, event_name):
     """Gets all the events of a certain name that have been received so
diff --git a/mobly/controllers/android_device_lib/errors.py b/mobly/controllers/android_device_lib/errors.py
index 416054d..9485034 100644
--- a/mobly/controllers/android_device_lib/errors.py
+++ b/mobly/controllers/android_device_lib/errors.py
@@ -45,6 +45,5 @@
   SERVICE_TYPE = None
 
   def __init__(self, device, msg):
-    new_msg = '%sService<%s> %s' % (HIERARCHY_TOKEN, self.SERVICE_TYPE,
-                    msg)
+    new_msg = '%sService<%s> %s' % (HIERARCHY_TOKEN, self.SERVICE_TYPE, msg)
     super(ServiceError, self).__init__(device, new_msg)
diff --git a/mobly/controllers/android_device_lib/event_dispatcher.py b/mobly/controllers/android_device_lib/event_dispatcher.py
index 6913113..81013d6 100644
--- a/mobly/controllers/android_device_lib/event_dispatcher.py
+++ b/mobly/controllers/android_device_lib/event_dispatcher.py
@@ -108,12 +108,12 @@
     """
     if self.started:
       raise IllegalStateError(("Can't register service after polling is"
-                   " started"))
+                               " started"))
     self.lock.acquire()
     try:
       if event_name in self.handlers:
         raise DuplicateError(
-          'A handler for {} already exists'.format(event_name))
+            'A handler for {} already exists'.format(event_name))
       self.handlers[event_name] = (handler, args)
     finally:
       self.lock.release()
@@ -176,14 +176,12 @@
         starts polling.
     """
     if not self.started:
-      raise IllegalStateError(
-        "Dispatcher needs to be started before popping.")
+      raise IllegalStateError("Dispatcher needs to be started before popping.")
 
     e_queue = self.get_event_q(event_name)
 
     if not e_queue:
-      raise TypeError(
-        "Failed to get an event queue for {}".format(event_name))
+      raise TypeError("Failed to get an event queue for {}".format(event_name))
 
     try:
       # Block for timeout
@@ -197,14 +195,14 @@
         return e_queue.get(True)
     except queue.Empty:
       raise queue.Empty('Timeout after {}s waiting for event: {}'.format(
-        timeout, event_name))
+          timeout, event_name))
 
   def wait_for_event(self,
-             event_name,
-             predicate,
-             timeout=DEFAULT_TIMEOUT,
-             *args,
-             **kwargs):
+                     event_name,
+                     predicate,
+                     timeout=DEFAULT_TIMEOUT,
+                     *args,
+                     **kwargs):
     """Wait for an event that satisfies a predicate to appear.
 
     Continuously pop events of a particular name and check against the
@@ -240,8 +238,7 @@
         return event
 
       if time.time() > deadline:
-        raise queue.Empty(
-          'Timeout after {}s waiting for event: {}'.format(
+        raise queue.Empty('Timeout after {}s waiting for event: {}'.format(
             timeout, event_name))
 
   def pop_events(self, regex_pattern, timeout):
@@ -269,8 +266,7 @@
       queue.Empty: Raised if no event was found before time out.
     """
     if not self.started:
-      raise IllegalStateError(
-        "Dispatcher needs to be started before popping.")
+      raise IllegalStateError("Dispatcher needs to be started before popping.")
     deadline = time.time() + timeout
     while True:
       #TODO: fix the sleep loop
@@ -280,7 +276,7 @@
       time.sleep(1)
     if len(results) == 0:
       raise queue.Empty('Timeout after {}s waiting for event: {}'.format(
-        timeout, regex_pattern))
+          timeout, regex_pattern))
 
     return sorted(results, key=lambda event: event['time'])
 
@@ -315,8 +311,7 @@
         passed.
     """
     self.lock.acquire()
-    if event_name not in self.event_dict or self.event_dict[
-        event_name] is None:
+    if event_name not in self.event_dict or self.event_dict[event_name] is None:
       self.event_dict[event_name] = queue.Queue()
     self.lock.release()
 
@@ -336,8 +331,8 @@
     handler, args = self.handlers[event_name]
     self.executor.submit(handler, event_obj, *args)
 
-  def _handle(self, event_handler, event_name, user_args, event_timeout,
-        cond, cond_timeout):
+  def _handle(self, event_handler, event_name, user_args, event_timeout, cond,
+              cond_timeout):
     """Pop an event of specified type and calls its handler on it. If
     condition is not None, block until condition is met or timeout.
     """
@@ -347,12 +342,12 @@
     return event_handler(event, *user_args)
 
   def handle_event(self,
-           event_handler,
-           event_name,
-           user_args,
-           event_timeout=None,
-           cond=None,
-           cond_timeout=None):
+                   event_handler,
+                   event_name,
+                   user_args,
+                   event_timeout=None,
+                   cond=None,
+                   cond_timeout=None):
     """Handle events that don't have registered handlers
 
     In a new thread, poll one event of specified type from its queue and
@@ -377,8 +372,7 @@
       needs to return something to unblock.
     """
     worker = self.executor.submit(self._handle, event_handler, event_name,
-                    user_args, event_timeout, cond,
-                    cond_timeout)
+                                  user_args, event_timeout, cond, cond_timeout)
     return worker
 
   def pop_all(self, event_name):
@@ -399,7 +393,7 @@
     """
     if not self.started:
       raise IllegalStateError(("Dispatcher needs to be started before "
-                   "popping."))
+                               "popping."))
     results = []
     try:
       self.lock.acquire()
diff --git a/mobly/controllers/android_device_lib/fastboot.py b/mobly/controllers/android_device_lib/fastboot.py
index 0034547..754a039 100644
--- a/mobly/controllers/android_device_lib/fastboot.py
+++ b/mobly/controllers/android_device_lib/fastboot.py
@@ -58,9 +58,10 @@
     return exe_cmd(' '.join((self.fastboot_str, name, arg_str)))
 
   def args(self, *args):
-    return exe_cmd(' '.join((self.fastboot_str, ) + args))
+    return exe_cmd(' '.join((self.fastboot_str,) + args))
 
   def __getattr__(self, name):
+
     def fastboot_call(*args):
       clean_name = name.replace('_', '-')
       arg_str = ' '.join(str(elem) for elem in args)
diff --git a/mobly/controllers/android_device_lib/jsonrpc_client_base.py b/mobly/controllers/android_device_lib/jsonrpc_client_base.py
index bb8f639..d1509a7 100644
--- a/mobly/controllers/android_device_lib/jsonrpc_client_base.py
+++ b/mobly/controllers/android_device_lib/jsonrpc_client_base.py
@@ -226,22 +226,22 @@
     self._counter = self._id_counter()
     try:
       self._conn = socket.create_connection(('localhost', self.host_port),
-                        _SOCKET_CONNECTION_TIMEOUT)
+                                            _SOCKET_CONNECTION_TIMEOUT)
     except ConnectionRefusedError as err:
       # Retry using '127.0.0.1' for IPv4 enabled machines that only resolve
       # 'localhost' to '[::1]'.
-      self.log.debug('Failed to connect to localhost, trying 127.0.0.1: {}'
-             .format(str(err)))
+      self.log.debug(
+          'Failed to connect to localhost, trying 127.0.0.1: {}'.format(
+              str(err)))
       self._conn = socket.create_connection(('127.0.0.1', self.host_port),
-                        _SOCKET_CONNECTION_TIMEOUT)
+                                            _SOCKET_CONNECTION_TIMEOUT)
 
     self._conn.settimeout(_SOCKET_READ_TIMEOUT)
     self._client = self._conn.makefile(mode='brw')
 
     resp = self._cmd(cmd, uid)
     if not resp:
-      raise ProtocolError(self._ad,
-                ProtocolError.NO_RESPONSE_FROM_HANDSHAKE)
+      raise ProtocolError(self._ad, ProtocolError.NO_RESPONSE_FROM_HANDSHAKE)
     result = json.loads(str(resp, encoding='utf8'))
     if result['status']:
       self.uid = result['uid']
@@ -276,9 +276,8 @@
       self.log.debug('Snippet sent %s.', msg)
     except socket.error as e:
       raise Error(
-        self._ad,
-        'Encountered socket error "%s" sending RPC message "%s"' %
-        (e, msg))
+          self._ad,
+          'Encountered socket error "%s" sending RPC message "%s"' % (e, msg))
 
   def _client_receive(self):
     """Receives the server's response of an Rpc message.
@@ -297,15 +296,13 @@
         if _MAX_RPC_RESP_LOGGING_LENGTH >= len(response):
           self.log.debug('Snippet received: %s', response)
         else:
-          self.log.debug(
-            'Snippet received: %s... %d chars are truncated',
-            response[:_MAX_RPC_RESP_LOGGING_LENGTH],
-            len(response) - _MAX_RPC_RESP_LOGGING_LENGTH)
+          self.log.debug('Snippet received: %s... %d chars are truncated',
+                         response[:_MAX_RPC_RESP_LOGGING_LENGTH],
+                         len(response) - _MAX_RPC_RESP_LOGGING_LENGTH)
       return response
     except socket.error as e:
-      raise Error(
-        self._ad,
-        'Encountered socket error reading RPC response "%s"' % e)
+      raise Error(self._ad,
+                  'Encountered socket error reading RPC response "%s"' % e)
 
   def _cmd(self, command, uid=None):
     """Send a command to the server.
@@ -343,8 +340,7 @@
       self._client_send(request)
       response = self._client_receive()
     if not response:
-      raise ProtocolError(self._ad,
-                ProtocolError.NO_RESPONSE_FROM_SERVER)
+      raise ProtocolError(self._ad, ProtocolError.NO_RESPONSE_FROM_SERVER)
     result = json.loads(str(response, encoding='utf8'))
     if result['error']:
       raise ApiError(self._ad, result['error'])
@@ -353,12 +349,11 @@
     if result.get('callback') is not None:
       if self._event_client is None:
         self._event_client = self._start_event_client()
-      return callback_handler.CallbackHandler(
-        callback_id=result['callback'],
-        event_client=self._event_client,
-        ret_value=result['result'],
-        method_name=method,
-        ad=self._ad)
+      return callback_handler.CallbackHandler(callback_id=result['callback'],
+                                              event_client=self._event_client,
+                                              ret_value=result['result'],
+                                              method_name=method,
+                                              ad=self._ad)
     return result['result']
 
   def disable_hidden_api_blacklist(self):
@@ -367,10 +362,9 @@
     sdk_version = int(self._ad.build_info['build_version_sdk'])
     # we check version_codename in addition to sdk_version because P builds
     # in development report sdk_version 27, but still enforce the blacklist.
-    if self._ad.is_rootable and (sdk_version >= 28
-                   or version_codename == 'P'):
+    if self._ad.is_rootable and (sdk_version >= 28 or version_codename == 'P'):
       self._ad.adb.shell(
-        'settings put global hidden_api_blacklist_exemptions "*"')
+          'settings put global hidden_api_blacklist_exemptions "*"')
 
   def __getattr__(self, name):
     """Wrapper for python magic to turn method calls into RPC calls."""
diff --git a/mobly/controllers/android_device_lib/jsonrpc_shell_base.py b/mobly/controllers/android_device_lib/jsonrpc_shell_base.py
index acbcf7d..9d133a5 100755
--- a/mobly/controllers/android_device_lib/jsonrpc_shell_base.py
+++ b/mobly/controllers/android_device_lib/jsonrpc_shell_base.py
@@ -27,6 +27,7 @@
 
 
 class JsonRpcShellBase(object):
+
   def _start_services(self, console_env):
     """Starts the services needed by this client and adds them to console_env.
 
@@ -59,9 +60,8 @@
       elif len(serials) == 1:
         serial = serials[0]
       else:
-        raise Error(
-          'Expected one phone, but %d found. Use the -s flag or '
-          'specify ANDROID_SERIAL.' % len(serials))
+        raise Error('Expected one phone, but %d found. Use the -s flag or '
+                    'specify ANDROID_SERIAL.' % len(serials))
     if serial not in serials:
       raise Error('Device "%s" is not found by adb.' % serial)
     ads = android_device.get_instances([serial])
@@ -71,8 +71,8 @@
   def start_console(self):
     # Set up initial console environment
     console_env = {
-      'ad': self._ad,
-      'pprint': pprint.pprint,
+        'ad': self._ad,
+        'pprint': pprint.pprint,
     }
 
     # Start the services
diff --git a/mobly/controllers/android_device_lib/service_manager.py b/mobly/controllers/android_device_lib/service_manager.py
index 48f1aaf..144ec54 100644
--- a/mobly/controllers/android_device_lib/service_manager.py
+++ b/mobly/controllers/android_device_lib/service_manager.py
@@ -75,13 +75,11 @@
     if not inspect.isclass(service_class):
       raise Error(self._device, '"%s" is not a class!' % service_class)
     if not issubclass(service_class, base_service.BaseService):
-      raise Error(
-        self._device,
-        'Class %s is not a subclass of BaseService!' % service_class)
+      raise Error(self._device,
+                  'Class %s is not a subclass of BaseService!' % service_class)
     if alias in self._service_objects:
-      raise Error(
-        self._device,
-        'A service is already registered with alias "%s".' % alias)
+      raise Error(self._device,
+                  'A service is already registered with alias "%s".' % alias)
     service_obj = service_class(self._device, configs)
     service_obj.alias = alias
     if start_service:
@@ -98,11 +96,11 @@
     """
     if alias not in self._service_objects:
       raise Error(self._device,
-            'No service is registered with alias "%s".' % alias)
+                  'No service is registered with alias "%s".' % alias)
     service_obj = self._service_objects.pop(alias)
     if service_obj.is_alive:
-      with expects.expect_no_raises(
-          'Failed to stop service instance "%s".' % alias):
+      with expects.expect_no_raises('Failed to stop service instance "%s".' %
+                                    alias):
         service_obj.stop()
 
   def for_each(self, func):
@@ -114,9 +112,8 @@
     """
     aliases = list(self._service_objects.keys())
     for alias in aliases:
-      with expects.expect_no_raises(
-          'Failed to execute "%s" for service "%s".' %
-        (func.__name__, alias)):
+      with expects.expect_no_raises('Failed to execute "%s" for service "%s".' %
+                                    (func.__name__, alias)):
         func(self._service_objects[alias])
 
   def list_live_services(self):
@@ -130,7 +127,7 @@
     """
     aliases = []
     self.for_each(lambda service: aliases.append(service.alias)
-            if service.is_alive else None)
+                  if service.is_alive else None)
     return aliases
 
   def create_output_excerpts_all(self, test_info):
@@ -173,8 +170,7 @@
     """
     for alias, service in self._service_objects.items():
       if not service.is_alive:
-        with expects.expect_no_raises('Failed to start service "%s".' %
-                        alias):
+        with expects.expect_no_raises('Failed to start service "%s".' % alias):
           service.start()
 
   def start_services(self, service_alises):
@@ -189,9 +185,9 @@
     for name in service_alises:
       if name not in self._service_objects:
         raise Error(
-          self._device,
-          'No service is registered under the name "%s", cannot start.'
-          % name)
+            self._device,
+            'No service is registered under the name "%s", cannot start.' %
+            name)
       service = self._service_objects[name]
       if not service.is_alive:
         service.start()
@@ -205,8 +201,7 @@
     # to do a list conversion here.
     for alias, service in reversed(list(self._service_objects.items())):
       if service.is_alive:
-        with expects.expect_no_raises('Failed to stop service "%s".' %
-                        alias):
+        with expects.expect_no_raises('Failed to stop service "%s".' % alias):
           service.stop()
 
   def pause_all(self):
@@ -217,8 +212,7 @@
     # OrdereDict#items does not return a sequence in Python 3.4, so we have
     # to do a list conversion here.
     for alias, service in reversed(list(self._service_objects.items())):
-      with expects.expect_no_raises('Failed to pause service "%s".' %
-                      alias):
+      with expects.expect_no_raises('Failed to pause service "%s".' % alias):
         service.pause()
 
   def resume_all(self):
@@ -227,8 +221,7 @@
     Services will be resumed in the order they were registered.
     """
     for alias, service in self._service_objects.items():
-      with expects.expect_no_raises('Failed to resume service "%s".' %
-                      alias):
+      with expects.expect_no_raises('Failed to resume service "%s".' % alias):
         service.resume()
 
   def resume_services(self, service_alises):
@@ -242,9 +235,9 @@
     for name in service_alises:
       if name not in self._service_objects:
         raise Error(
-          self._device,
-          'No service is registered under the name "%s", cannot resume.'
-          % name)
+            self._device,
+            'No service is registered under the name "%s", cannot resume.' %
+            name)
       service = self._service_objects[name]
       service.resume()
 
diff --git a/mobly/controllers/android_device_lib/services/logcat.py b/mobly/controllers/android_device_lib/services/logcat.py
index c470b17..ef8d44a 100644
--- a/mobly/controllers/android_device_lib/services/logcat.py
+++ b/mobly/controllers/android_device_lib/services/logcat.py
@@ -41,10 +41,7 @@
       generate one if not specified.
   """
 
-  def __init__(self,
-         logcat_params=None,
-         clear_log=True,
-         output_file_path=None):
+  def __init__(self, logcat_params=None, clear_log=True, output_file_path=None):
     self.clear_log = clear_log
     self.logcat_params = logcat_params if logcat_params else ''
     self.output_file_path = output_file_path
@@ -77,7 +74,7 @@
       return
 
     logpersist_warning = ('%s encountered an error enabling persistent'
-                ' logs, logs may not get saved.')
+                          ' logs, logs may not get saved.')
     # Android L and older versions do not have logpersist installed,
     # so check that the logpersist scripts exists before trying to use
     # them.
@@ -95,8 +92,7 @@
       logging.warning(logpersist_warning, self)
 
   def _is_timestamp_in_range(self, target, begin_time, end_time):
-    low = mobly_logger.logline_timestamp_comparator(begin_time,
-                            target) <= 0
+    low = mobly_logger.logline_timestamp_comparator(begin_time, target) <= 0
     high = mobly_logger.logline_timestamp_comparator(end_time, target) >= 0
     return low and high
 
@@ -118,10 +114,10 @@
     dest_path = test_info.output_path
     utils.create_dir(dest_path)
     filename = self._ad.generate_filename(self.OUTPUT_FILE_TYPE, test_info,
-                        'txt')
+                                          'txt')
     excerpt_file_path = os.path.join(dest_path, filename)
     with io.open(excerpt_file_path, 'w', encoding='utf-8',
-           errors='replace') as out:
+                 errors='replace') as out:
       # Devices may accidentally go offline during test,
       # check not None before readline().
       while self._adb_logcat_file_obj:
@@ -144,8 +140,7 @@
       # On Android O, the clear command fails due to a known bug.
       # Catching this so we don't crash from this Android issue.
       if b'failed to clear' in e.stderr:
-        self._ad.log.warning(
-          'Encountered known Android error to clear logcat.')
+        self._ad.log.warning('Encountered known Android error to clear logcat.')
       else:
         raise
 
@@ -157,8 +152,8 @@
     """
     if self.is_alive:
       raise Error(
-        self._ad,
-        'Logcat thread is already running, cannot start another one.')
+          self._ad,
+          'Logcat thread is already running, cannot start another one.')
 
   def update_config(self, new_config):
     """Updates the configuration for the service.
@@ -174,7 +169,7 @@
     """
     self._assert_not_running()
     self._ad.log.info('[LogcatService] Changing config from %s to %s',
-              self._config, new_config)
+                      self._config, new_config)
     self._config = new_config
 
   def _open_logcat_file(self):
@@ -186,13 +181,13 @@
       start_time = time.time()
       while not os.path.exists(self.adb_logcat_file_path):
         if time.time() > start_time + CREATE_LOGCAT_FILE_TIMEOUT_SEC:
-          raise Error(
-            self._ad,
-            'Timeout while waiting for logcat file to be created.')
+          raise Error(self._ad,
+                      'Timeout while waiting for logcat file to be created.')
         time.sleep(1)
-      self._adb_logcat_file_obj = io.open(
-        self.adb_logcat_file_path, 'r', encoding='utf-8',
-        errors='replace')
+      self._adb_logcat_file_obj = io.open(self.adb_logcat_file_path,
+                                          'r',
+                                          encoding='utf-8',
+                                          errors='replace')
       self._adb_logcat_file_obj.seek(0, os.SEEK_END)
 
   def _close_logcat_file(self):
@@ -220,7 +215,7 @@
       self.adb_logcat_file_path = self._config.output_file_path
     if not self.adb_logcat_file_path:
       f_name = self._ad.generate_filename(self.OUTPUT_FILE_TYPE,
-                        extension_name='txt')
+                                          extension_name='txt')
       logcat_file_path = os.path.join(self._ad.log_path, f_name)
       self.adb_logcat_file_path = logcat_file_path
     utils.create_dir(os.path.dirname(self.adb_logcat_file_path))
@@ -228,8 +223,8 @@
     # double quotes in args if starting and ending with it.
     # Add spaces at beginning and at last to fix this issue.
     cmd = ' "%s" -s %s logcat -v threadtime -T 1 %s >> "%s" ' % (
-      adb.ADB, self._ad.serial, self._config.logcat_params,
-      self.adb_logcat_file_path)
+        adb.ADB, self._ad.serial, self._config.logcat_params,
+        self.adb_logcat_file_path)
     process = utils.start_standing_subprocess(cmd, shell=True)
     self._adb_logcat_process = process
 
diff --git a/mobly/controllers/android_device_lib/services/snippet_management_service.py b/mobly/controllers/android_device_lib/services/snippet_management_service.py
index 5c60b25..6c1c5bd 100644
--- a/mobly/controllers/android_device_lib/services/snippet_management_service.py
+++ b/mobly/controllers/android_device_lib/services/snippet_management_service.py
@@ -41,8 +41,7 @@
   @property
   def is_alive(self):
     """True if any client is running, False otherwise."""
-    return any(
-      [client.is_alive for client in self._snippet_clients.values()])
+    return any([client.is_alive for client in self._snippet_clients.values()])
 
   def get_snippet_client(self, name):
     """Gets the snippet client managed under a given name.
@@ -71,17 +70,14 @@
     # Should not load snippet with the same name more than once.
     if name in self._snippet_clients:
       raise Error(
-        self,
-        'Name "%s" is already registered with package "%s", it cannot '
-        'be used again.' %
-        (name, self._snippet_clients[name].client.package))
+          self, 'Name "%s" is already registered with package "%s", it cannot '
+          'be used again.' % (name, self._snippet_clients[name].client.package))
     # Should not load the same snippet package more than once.
     for snippet_name, client in self._snippet_clients.items():
       if package == client.package:
         raise Error(
-          self,
-          'Snippet package "%s" has already been loaded under name'
-          ' "%s".' % (package, snippet_name))
+            self, 'Snippet package "%s" has already been loaded under name'
+            ' "%s".' % (package, snippet_name))
     client = snippet_client.SnippetClient(package=package, ad=self._device)
     client.start_app_and_connect()
     self._snippet_clients[name] = client
@@ -104,25 +100,23 @@
     """Starts all the snippet clients under management."""
     for client in self._snippet_clients.values():
       if not client.is_alive:
-        self._device.log.debug('Starting SnippetClient<%s>.',
-                     client.package)
+        self._device.log.debug('Starting SnippetClient<%s>.', client.package)
         client.start_app_and_connect()
       else:
         self._device.log.debug(
-          'Not startng SnippetClient<%s> because it is already alive.',
-          client.package)
+            'Not startng SnippetClient<%s> because it is already alive.',
+            client.package)
 
   def stop(self):
     """Stops all the snippet clients under management."""
     for client in self._snippet_clients.values():
       if client.is_alive:
-        self._device.log.debug('Stopping SnippetClient<%s>.',
-                     client.package)
+        self._device.log.debug('Stopping SnippetClient<%s>.', client.package)
         client.stop_app()
       else:
         self._device.log.debug(
-          'Not stopping SnippetClient<%s> because it is not alive.',
-          client.package)
+            'Not stopping SnippetClient<%s> because it is not alive.',
+            client.package)
 
   def pause(self):
     """Pauses all the snippet clients under management.
@@ -131,9 +125,8 @@
     allocated in `resume`.
     """
     for client in self._snippet_clients.values():
-      self._device.log.debug(
-        'Clearing host port %d of SnippetClient<%s>.',
-        client.host_port, client.package)
+      self._device.log.debug('Clearing host port %d of SnippetClient<%s>.',
+                             client.host_port, client.package)
       client.clear_host_port()
 
   def resume(self):
@@ -142,12 +135,11 @@
       # Resume is only applicable if a client is alive and does not have
       # a host port.
       if client.is_alive and client.host_port is None:
-        self._device.log.debug('Resuming SnippetClient<%s>.',
-                     client.package)
+        self._device.log.debug('Resuming SnippetClient<%s>.', client.package)
         client.restore_app_connection()
       else:
         self._device.log.debug('Not resuming SnippetClient<%s>.',
-                     client.package)
+                               client.package)
 
   def __getattr__(self, name):
     client = self.get_snippet_client(name)
diff --git a/mobly/controllers/android_device_lib/sl4a_client.py b/mobly/controllers/android_device_lib/sl4a_client.py
index dd79553..2c396ee 100644
--- a/mobly/controllers/android_device_lib/sl4a_client.py
+++ b/mobly/controllers/android_device_lib/sl4a_client.py
@@ -22,9 +22,9 @@
 _APP_NAME = 'SL4A'
 _DEVICE_SIDE_PORT = 8080
 _LAUNCH_CMD = (
-  'am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER '
-  '--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT %s '
-  'com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher')
+    'am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER '
+    '--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT %s '
+    'com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher')
 # Maximum time to wait for the app to start on the device (10 minutes).
 # TODO: This timeout is set high in order to allow for retries in
 # start_app_and_connect. Decrease it when the call to connect() has the option
@@ -59,8 +59,7 @@
     out = self._adb.shell('pm list package')
     if not utils.grep('com.googlecode.android_scripting', out):
       raise jsonrpc_client_base.AppStartError(
-        self._ad,
-        '%s is not installed on %s' % (_APP_NAME, self._adb.serial))
+          self._ad, '%s is not installed on %s' % (_APP_NAME, self._adb.serial))
     self.disable_hidden_api_blacklist()
 
     # sl4a has problems connecting after disconnection, so kill the apk and
@@ -110,7 +109,7 @@
           self.closeSl4aSession()
         except:
           self.log.exception('Failed to gracefully shut down %s.',
-                     self.app_name)
+                             self.app_name)
 
         # Close the socket connection.
         self.disconnect()
@@ -132,9 +131,7 @@
       self.ed = None
 
   def _retry_connect(self):
-    self._adb.forward(
-      ['tcp:%d' % self.host_port,
-       'tcp:%d' % self.device_port])
+    self._adb.forward(['tcp:%d' % self.host_port, 'tcp:%d' % self.device_port])
     start_time = time.time()
     expiration_time = start_time + _APP_START_WAIT_TIME
     started = False
@@ -146,14 +143,14 @@
         break
       except:
         self.log.debug('%s is not yet running, retrying',
-                 self.app_name,
-                 exc_info=True)
+                       self.app_name,
+                       exc_info=True)
       time.sleep(1)
     if not started:
       raise jsonrpc_client_base.AppRestoreConnectionError(
-        self._ad, '%s failed to connect for %s at host port %s, '
-        'device port %s' % (self.app_name, self._adb.serial,
-                  self.host_port, self.device_port))
+          self._ad, '%s failed to connect for %s at host port %s, '
+          'device port %s' %
+          (self.app_name, self._adb.serial, self.host_port, self.device_port))
 
   def _start_event_client(self):
     # Start an EventDispatcher for the current sl4a session
@@ -161,7 +158,7 @@
     event_client.host_port = self.host_port
     event_client.device_port = self.device_port
     event_client.connect(uid=self.uid,
-               cmd=jsonrpc_client_base.JsonRpcCommand.CONTINUE)
+                         cmd=jsonrpc_client_base.JsonRpcCommand.CONTINUE)
     ed = event_dispatcher.EventDispatcher(event_client)
     ed.start()
     return ed
diff --git a/mobly/controllers/android_device_lib/snippet_client.py b/mobly/controllers/android_device_lib/snippet_client.py
index aded347..eb8503e 100644
--- a/mobly/controllers/android_device_lib/snippet_client.py
+++ b/mobly/controllers/android_device_lib/snippet_client.py
@@ -24,7 +24,7 @@
 from mobly.controllers.android_device_lib import jsonrpc_client_base
 
 _INSTRUMENTATION_RUNNER_PACKAGE = (
-  'com.google.android.mobly.snippet.SnippetRunner')
+    'com.google.android.mobly.snippet.SnippetRunner')
 
 # Major version of the launch and communication protocol being used by this
 # client.
@@ -40,11 +40,11 @@
 _PROTOCOL_MINOR_VERSION = 0
 
 _LAUNCH_CMD = (
-  '{shell_cmd} am instrument {user} -w -e action start {snippet_package}/' +
-  _INSTRUMENTATION_RUNNER_PACKAGE)
+    '{shell_cmd} am instrument {user} -w -e action start {snippet_package}/' +
+    _INSTRUMENTATION_RUNNER_PACKAGE)
 
 _STOP_CMD = ('am instrument {user} -w -e action stop {snippet_package}/' +
-       _INSTRUMENTATION_RUNNER_PACKAGE)
+             _INSTRUMENTATION_RUNNER_PACKAGE)
 
 # Test that uses UiAutomation requires the shell session to be maintained while
 # test is in progress. However, this requirement does not hold for the test that
@@ -147,7 +147,7 @@
         self.stop_app()
       except:
         self._ad.log.exception(
-          'Failed to stop app after failure to start and connect.')
+            'Failed to stop app after failure to start and connect.')
       # Explicitly raise the original error from starting app.
       raise e
 
@@ -170,12 +170,11 @@
     # process. Starting snippets can be slow, especially if there are
     # multiple, and this avoids the perception that the framework is hanging
     # for a long time doing nothing.
-    self.log.info('Launching snippet apk %s with protocol %d.%d',
-            self.package, _PROTOCOL_MAJOR_VERSION,
-            _PROTOCOL_MINOR_VERSION)
+    self.log.info('Launching snippet apk %s with protocol %d.%d', self.package,
+                  _PROTOCOL_MAJOR_VERSION, _PROTOCOL_MINOR_VERSION)
     cmd = _LAUNCH_CMD.format(shell_cmd=persists_shell_cmd,
-                 user=self._get_user_command_string(),
-                 snippet_package=self.package)
+                             user=self._get_user_command_string(),
+                             snippet_package=self.package)
     start_time = time.time()
     self._proc = self._do_start_app(cmd)
 
@@ -193,15 +192,13 @@
 
     # Forward the device port to a new host port, and connect to that port
     self.host_port = utils.get_available_host_port()
-    self._adb.forward(
-      ['tcp:%d' % self.host_port,
-       'tcp:%d' % self.device_port])
+    self._adb.forward(['tcp:%d' % self.host_port, 'tcp:%d' % self.device_port])
     self.connect()
 
     # Yaaay! We're done!
     self.log.debug('Snippet %s started after %.1fs on host port %s',
-             self.package,
-             time.time() - start_time, self.host_port)
+                   self.package,
+                   time.time() - start_time, self.host_port)
 
   def restore_app_connection(self, port=None):
     """Restores the app after device got reconnected.
@@ -220,19 +217,16 @@
       AppRestoreConnectionError: When the app was not able to be started.
     """
     self.host_port = port or utils.get_available_host_port()
-    self._adb.forward(
-      ['tcp:%d' % self.host_port,
-       'tcp:%d' % self.device_port])
+    self._adb.forward(['tcp:%d' % self.host_port, 'tcp:%d' % self.device_port])
     try:
       self.connect()
     except:
       # Log the original error and raise AppRestoreConnectionError.
       self.log.exception('Failed to re-connect to app.')
       raise jsonrpc_client_base.AppRestoreConnectionError(
-        self._ad,
-        ('Failed to restore app connection for %s at host port %s, '
-         'device port %s') %
-        (self.package, self.host_port, self.device_port))
+          self._ad,
+          ('Failed to restore app connection for %s at host port %s, '
+           'device port %s') % (self.package, self.host_port, self.device_port))
 
     # Because the previous connection was lost, update self._proc
     self._proc = None
@@ -252,13 +246,13 @@
         utils.stop_standing_subprocess(self._proc)
       self._proc = None
       out = self._adb.shell(
-        _STOP_CMD.format(
-          snippet_package=self.package,
-          user=self._get_user_command_string())).decode('utf-8')
+          _STOP_CMD.format(
+              snippet_package=self.package,
+              user=self._get_user_command_string())).decode('utf-8')
       if 'OK (0 tests)' not in out:
         raise errors.DeviceError(
-          self._ad,
-          'Failed to stop existing apk. Unexpected output: %s' % out)
+            self._ad,
+            'Failed to stop existing apk. Unexpected output: %s' % out)
     finally:
       # Always clean up the adb port
       self.clear_host_port()
@@ -268,8 +262,7 @@
     event_client = SnippetClient(package=self.package, ad=self._ad)
     event_client.host_port = self.host_port
     event_client.device_port = self.device_port
-    event_client.connect(self.uid,
-               jsonrpc_client_base.JsonRpcCommand.CONTINUE)
+    event_client.connect(self.uid, jsonrpc_client_base.JsonRpcCommand.CONTINUE)
     return event_client
 
   def _restore_event_client(self):
@@ -287,19 +280,19 @@
     out = self._adb.shell('pm list package --user %s' % user_id)
     if not utils.grep('^package:%s$' % self.package, out):
       raise AppStartPreCheckError(
-        self._ad,
-        '%s is not installed for user %s.' % (self.package, user_id))
+          self._ad,
+          '%s is not installed for user %s.' % (self.package, user_id))
     # Check that the app is instrumented.
     out = self._adb.shell('pm list instrumentation')
     matched_out = utils.grep(
-      '^instrumentation:%s/%s' %
-      (self.package, _INSTRUMENTATION_RUNNER_PACKAGE), out)
+        '^instrumentation:%s/%s' %
+        (self.package, _INSTRUMENTATION_RUNNER_PACKAGE), out)
     if not matched_out:
       raise AppStartPreCheckError(
-        self._ad,
-        '%s is installed, but it is not instrumented.' % self.package)
+          self._ad,
+          '%s is installed, but it is not instrumented.' % self.package)
     match = re.search(r'^instrumentation:(.*)\/(.*) \(target=(.*)\)$',
-              matched_out[0])
+                      matched_out[0])
     target_name = match.group(3)
     # Check that the instrumentation target is installed if it's not the
     # same as the snippet package.
@@ -307,9 +300,9 @@
       out = self._adb.shell('pm list package --user %s' % user_id)
       if not utils.grep('^package:%s$' % target_name, out):
         raise AppStartPreCheckError(
-          self._ad,
-          'Instrumentation target %s is not installed for user %s.' %
-          (target_name, user_id))
+            self._ad,
+            'Instrumentation target %s is not installed for user %s.' %
+            (target_name, user_id))
 
   def _do_start_app(self, launch_cmd):
     adb_cmd = [adb.ADB]
@@ -335,34 +328,31 @@
       line = self._proc.stdout.readline().decode('utf-8')
       if not line:
         raise jsonrpc_client_base.AppStartError(
-          self._ad, 'Unexpected EOF waiting for app to start')
+            self._ad, 'Unexpected EOF waiting for app to start')
       # readline() uses an empty string to mark EOF, and a single newline
       # to mark regular empty lines in the output. Don't move the strip()
       # call above the truthiness check, or this method will start
       # considering any blank output line to be EOF.
       line = line.strip()
-      if (line.startswith('INSTRUMENTATION_RESULT:')
-          or line.startswith('SNIPPET ')):
-        self.log.debug(
-          'Accepted line from instrumentation output: "%s"', line)
+      if (line.startswith('INSTRUMENTATION_RESULT:') or
+          line.startswith('SNIPPET ')):
+        self.log.debug('Accepted line from instrumentation output: "%s"', line)
         return line
-      self.log.debug('Discarded line from instrumentation output: "%s"',
-               line)
+      self.log.debug('Discarded line from instrumentation output: "%s"', line)
 
   def _get_persist_command(self):
     """Check availability and return path of command if available."""
     for command in [_SETSID_COMMAND, _NOHUP_COMMAND]:
       try:
-        if command in self._adb.shell(['which',
-                         command]).decode('utf-8'):
+        if command in self._adb.shell(['which', command]).decode('utf-8'):
           return command
       except adb.AdbError:
         continue
     self.log.warning(
-      'No %s and %s commands available to launch instrument '
-      'persistently, tests that depend on UiAutomator and '
-      'at the same time performs USB disconnection may fail',
-      _SETSID_COMMAND, _NOHUP_COMMAND)
+        'No %s and %s commands available to launch instrument '
+        'persistently, tests that depend on UiAutomator and '
+        'at the same time performs USB disconnection may fail', _SETSID_COMMAND,
+        _NOHUP_COMMAND)
     return ''
 
   def help(self, print_output=True):
diff --git a/mobly/controllers/android_device_lib/snippet_event.py b/mobly/controllers/android_device_lib/snippet_event.py
index 9a87215..bd38671 100644
--- a/mobly/controllers/android_device_lib/snippet_event.py
+++ b/mobly/controllers/android_device_lib/snippet_event.py
@@ -23,9 +23,9 @@
     A SnippetEvent object.
   """
   return SnippetEvent(callback_id=event_dict['callbackId'],
-            name=event_dict['name'],
-            creation_time=event_dict['time'],
-            data=event_dict['data'])
+                      name=event_dict['name'],
+                      creation_time=event_dict['time'],
+                      data=event_dict['data'])
 
 
 class SnippetEvent(object):
@@ -47,5 +47,5 @@
 
   def __repr__(self):
     return ('SnippetEvent(callback_id: %s, name: %s, creation_time: %s, '
-        'data: %s)') % (self.callback_id, self.name,
-                self.creation_time, self.data)
+            'data: %s)') % (self.callback_id, self.name, self.creation_time,
+                            self.data)
diff --git a/mobly/controllers/attenuator.py b/mobly/controllers/attenuator.py
index a8faee3..aef9d71 100644
--- a/mobly/controllers/attenuator.py
+++ b/mobly/controllers/attenuator.py
@@ -53,38 +53,37 @@
 
 
 def create(configs):
-    objs = []
-    for config in configs:
-        _validate_config(config)
-        attenuator_model = config[KEY_MODEL]
-        # Import the correct driver module for the attenuator device
-        module_name = PACKAGE_PATH_TEMPLATE % attenuator_model
-        module = importlib.import_module(module_name)
-        # Create each
-        attenuation_device = module.AttenuatorDevice(
-            path_count=len(config[KEY_PATHS]))
-        attenuation_device.model = attenuator_model
-        instances = attenuation_device.open(config[KEY_ADDRESS],
-                                            config[KEY_PORT])
-        for idx, path_name in enumerate(config[KEY_PATHS]):
-            path = AttenuatorPath(attenuation_device, idx=idx, name=path_name)
-            objs.append(path)
-    return objs
+  objs = []
+  for config in configs:
+    _validate_config(config)
+    attenuator_model = config[KEY_MODEL]
+    # Import the correct driver module for the attenuator device
+    module_name = PACKAGE_PATH_TEMPLATE % attenuator_model
+    module = importlib.import_module(module_name)
+    # Create each
+    attenuation_device = module.AttenuatorDevice(
+        path_count=len(config[KEY_PATHS]))
+    attenuation_device.model = attenuator_model
+    instances = attenuation_device.open(config[KEY_ADDRESS], config[KEY_PORT])
+    for idx, path_name in enumerate(config[KEY_PATHS]):
+      path = AttenuatorPath(attenuation_device, idx=idx, name=path_name)
+      objs.append(path)
+  return objs
 
 
 def destroy(objs):
-    for attenuation_path in objs:
-        attenuation_path.attenuation_device.close()
+  for attenuation_path in objs:
+    attenuation_path.attenuation_device.close()
 
 
 class Error(Exception):
-    """This is the Exception class defined for all errors generated by
+  """This is the Exception class defined for all errors generated by
     Attenuator-related modules.
     """
 
 
 def _validate_config(config):
-    """Verifies that a config dict for an attenuator device is valid.
+  """Verifies that a config dict for an attenuator device is valid.
 
     Args:
         config: A dict that is the configuration for an attenuator device.
@@ -92,15 +91,14 @@
     Raises:
         attenuator.Error: A config is not valid.
     """
-    required_keys = [KEY_ADDRESS, KEY_MODEL, KEY_PORT, KEY_PATHS]
-    for key in required_keys:
-        if key not in config:
-            raise Error("Required key %s missing from config %s",
-                        (key, config))
+  required_keys = [KEY_ADDRESS, KEY_MODEL, KEY_PORT, KEY_PATHS]
+  for key in required_keys:
+    if key not in config:
+      raise Error("Required key %s missing from config %s", (key, config))
 
 
 class AttenuatorPath(object):
-    """A convenience class that allows users to control each attenuator path
+  """A convenience class that allows users to control each attenuator path
     separately as different objects, as opposed to passing in an index number
     to the functions of an attenuator device object.
 
@@ -127,35 +125,35 @@
     latter forces the test bed to use a four-channel attenuator.
     """
 
-    def __init__(self, attenuation_device, idx=0, name=None):
-        self.model = attenuation_device.model
-        self.attenuation_device = attenuation_device
-        self.idx = idx
-        if (self.idx >= attenuation_device.path_count):
-            raise IndexError("Attenuator index out of range!")
+  def __init__(self, attenuation_device, idx=0, name=None):
+    self.model = attenuation_device.model
+    self.attenuation_device = attenuation_device
+    self.idx = idx
+    if (self.idx >= attenuation_device.path_count):
+      raise IndexError("Attenuator index out of range!")
 
-    def set_atten(self, value):
-        """This function sets the attenuation of Attenuator.
+  def set_atten(self, value):
+    """This function sets the attenuation of Attenuator.
 
         Args:
             value: This is a floating point value for nominal attenuation to be
                 set. Unit is db.
         """
-        self.attenuation_device.set_atten(self.idx, value)
+    self.attenuation_device.set_atten(self.idx, value)
 
-    def get_atten(self):
-        """Gets the current attenuation setting of Attenuator.
+  def get_atten(self):
+    """Gets the current attenuation setting of Attenuator.
 
         Returns:
             A float that is the current attenuation value. Unit is db.
         """
 
-        return self.attenuation_device.get_atten(self.idx)
+    return self.attenuation_device.get_atten(self.idx)
 
-    def get_max_atten(self):
-        """Gets the max attenuation supported by the Attenuator.
+  def get_max_atten(self):
+    """Gets the max attenuation supported by the Attenuator.
 
         Returns:
             A float that is the max attenuation value.
         """
-        return self.attenuation_device.max_atten
+    return self.attenuation_device.max_atten
diff --git a/mobly/controllers/attenuator_lib/minicircuits.py b/mobly/controllers/attenuator_lib/minicircuits.py
index 84b946a..bb3eb68 100644
--- a/mobly/controllers/attenuator_lib/minicircuits.py
+++ b/mobly/controllers/attenuator_lib/minicircuits.py
@@ -23,32 +23,32 @@
 
 
 class AttenuatorDevice(object):
-    """This provides a specific telnet-controlled implementation of
+  """This provides a specific telnet-controlled implementation of
     AttenuatorDevice for Mini-Circuits RC-DAT attenuators.
 
     Attributes:
         path_count: The number of signal attenuation path this device has.
     """
 
-    def __init__(self, path_count=1):
-        self.path_count = path_count
-        # The telnet client used to communicate with the attenuator device.
-        self._telnet_client = telnet_scpi_client.TelnetScpiClient(
-            tx_cmd_separator="\r\n", rx_cmd_separator="\r\n", prompt="")
+  def __init__(self, path_count=1):
+    self.path_count = path_count
+    # The telnet client used to communicate with the attenuator device.
+    self._telnet_client = telnet_scpi_client.TelnetScpiClient(
+        tx_cmd_separator="\r\n", rx_cmd_separator="\r\n", prompt="")
 
-    @property
-    def is_open(self):
-        """This function returns the state of the telnet connection to the
+  @property
+  def is_open(self):
+    """This function returns the state of the telnet connection to the
         underlying AttenuatorDevice.
 
         Returns:
             True if there is a successfully open connection to the
             AttenuatorDevice.
         """
-        return bool(self._telnet_client.is_open)
+    return bool(self._telnet_client.is_open)
 
-    def open(self, host, port=23):
-        """Opens a telnet connection to the desired AttenuatorDevice and
+  def open(self, host, port=23):
+    """Opens a telnet connection to the desired AttenuatorDevice and
         queries basic information.
 
         Args:
@@ -56,25 +56,25 @@
                 MC-DAT attenuator instrument.
             port: An optional port number (defaults to telnet default 23)
         """
-        self._telnet_client.open(host, port)
-        config_str = self._telnet_client.cmd("MN?")
-        if config_str.startswith("MN="):
-            config_str = config_str[len("MN="):]
-        self.properties = dict(
-            zip(['model', 'max_freq', 'max_atten'], config_str.split("-", 2)))
-        self.max_atten = float(self.properties['max_atten'])
+    self._telnet_client.open(host, port)
+    config_str = self._telnet_client.cmd("MN?")
+    if config_str.startswith("MN="):
+      config_str = config_str[len("MN="):]
+    self.properties = dict(
+        zip(['model', 'max_freq', 'max_atten'], config_str.split("-", 2)))
+    self.max_atten = float(self.properties['max_atten'])
 
-    def close(self):
-        """Closes a telnet connection to the desired attenuator device.
+  def close(self):
+    """Closes a telnet connection to the desired attenuator device.
 
         This should be called as part of any teardown procedure prior to the
         attenuator instrument leaving scope.
         """
-        if self.is_open:
-            self._telnet_client.close()
+    if self.is_open:
+      self._telnet_client.close()
 
-    def set_atten(self, idx, value):
-        """Sets the attenuation value for a particular signal path.
+  def set_atten(self, idx, value):
+    """Sets the attenuation value for a particular signal path.
 
         Args:
             idx: Zero-based index int which is the identifier for a particular
@@ -90,21 +90,18 @@
             ValueError: The requested set value is greater than the maximum
                 attenuation value.
         """
-        if not self.is_open:
-            raise attenuator.Error(
-                "Connection to attenuator at %s is not open!" %
-                self._telnet_client.host)
-        if idx + 1 > self.path_count:
-            raise IndexError("Attenuator index out of range!", self.path_count,
-                             idx)
-        if value > self.max_atten:
-            raise ValueError("Attenuator value out of range!", self.max_atten,
-                             value)
-        # The actual device uses one-based index for channel numbers.
-        self._telnet_client.cmd("CHAN:%s:SETATT:%s" % (idx + 1, value))
+    if not self.is_open:
+      raise attenuator.Error("Connection to attenuator at %s is not open!" %
+                             self._telnet_client.host)
+    if idx + 1 > self.path_count:
+      raise IndexError("Attenuator index out of range!", self.path_count, idx)
+    if value > self.max_atten:
+      raise ValueError("Attenuator value out of range!", self.max_atten, value)
+    # The actual device uses one-based index for channel numbers.
+    self._telnet_client.cmd("CHAN:%s:SETATT:%s" % (idx + 1, value))
 
-    def get_atten(self, idx=0):
-        """This function returns the current attenuation from an attenuator at a
+  def get_atten(self, idx=0):
+    """This function returns the current attenuation from an attenuator at a
         given index in the instrument.
 
         Args:
@@ -118,13 +115,11 @@
         Returns:
             A float that is the current attenuation value.
         """
-        if not self.is_open:
-            raise attenuator.Error(
-                "Connection to attenuator at %s is not open!" %
-                self._telnet_client.host)
-        if idx + 1 > self.path_count or idx < 0:
-            raise IndexError("Attenuator index out of range!", self.path_count,
-                             idx)
-        atten_val_str = self._telnet_client.cmd("CHAN:%s:ATT?" % (idx + 1))
-        atten_val = float(atten_val_str)
-        return atten_val
+    if not self.is_open:
+      raise attenuator.Error("Connection to attenuator at %s is not open!" %
+                             self._telnet_client.host)
+    if idx + 1 > self.path_count or idx < 0:
+      raise IndexError("Attenuator index out of range!", self.path_count, idx)
+    atten_val_str = self._telnet_client.cmd("CHAN:%s:ATT?" % (idx + 1))
+    atten_val = float(atten_val_str)
+    return atten_val
diff --git a/mobly/controllers/attenuator_lib/telnet_scpi_client.py b/mobly/controllers/attenuator_lib/telnet_scpi_client.py
index 9fddb0c..31660a9 100644
--- a/mobly/controllers/attenuator_lib/telnet_scpi_client.py
+++ b/mobly/controllers/attenuator_lib/telnet_scpi_client.py
@@ -23,62 +23,60 @@
 
 
 def _ascii_string(uc_string):
-    return str(uc_string).encode('ASCII')
+  return str(uc_string).encode('ASCII')
 
 
 class TelnetScpiClient(object):
-    """This is an internal helper class for Telnet+SCPI command-based
+  """This is an internal helper class for Telnet+SCPI command-based
     instruments. It should only be used by those implemention control libraries
     and not by any user code directly.
     """
 
-    def __init__(self, tx_cmd_separator="\n", rx_cmd_separator="\n",
-                 prompt=""):
-        self._tn = None
-        self.tx_cmd_separator = tx_cmd_separator
-        self.rx_cmd_separator = rx_cmd_separator
-        self.prompt = prompt
-        self.host = None
-        self.port = None
+  def __init__(self, tx_cmd_separator="\n", rx_cmd_separator="\n", prompt=""):
+    self._tn = None
+    self.tx_cmd_separator = tx_cmd_separator
+    self.rx_cmd_separator = rx_cmd_separator
+    self.prompt = prompt
+    self.host = None
+    self.port = None
 
-    def open(self, host, port=23):
-        if self._tn:
-            self._tn.close()
-        self.host = host
-        self.port = port
-        self._tn = telnetlib.Telnet()
-        self._tn.open(host, port, 10)
+  def open(self, host, port=23):
+    if self._tn:
+      self._tn.close()
+    self.host = host
+    self.port = port
+    self._tn = telnetlib.Telnet()
+    self._tn.open(host, port, 10)
 
-    @property
-    def is_open(self):
-        return bool(self._tn)
+  @property
+  def is_open(self):
+    return bool(self._tn)
 
-    def close(self):
-        if self._tn:
-            self._tn.close()
-            self._tn = None
+  def close(self):
+    if self._tn:
+      self._tn.close()
+      self._tn = None
 
-    def cmd(self, cmd_str, wait_ret=True):
-        if not isinstance(cmd_str, str):
-            raise TypeError("Invalid command string", cmd_str)
-        if not self.is_open:
-            raise attenuator.Error("Telnet connection not open for commands")
+  def cmd(self, cmd_str, wait_ret=True):
+    if not isinstance(cmd_str, str):
+      raise TypeError("Invalid command string", cmd_str)
+    if not self.is_open:
+      raise attenuator.Error("Telnet connection not open for commands")
 
-        cmd_str.strip(self.tx_cmd_separator)
-        self._tn.read_until(_ascii_string(self.prompt), 2)
-        self._tn.write(_ascii_string(cmd_str + self.tx_cmd_separator))
-        if wait_ret is False:
-            return None
+    cmd_str.strip(self.tx_cmd_separator)
+    self._tn.read_until(_ascii_string(self.prompt), 2)
+    self._tn.write(_ascii_string(cmd_str + self.tx_cmd_separator))
+    if wait_ret is False:
+      return None
 
-        match_idx, match_val, ret_text = self._tn.expect(
-            [_ascii_string("\S+" + self.rx_cmd_separator)], 1)
+    match_idx, match_val, ret_text = self._tn.expect(
+        [_ascii_string("\S+" + self.rx_cmd_separator)], 1)
 
-        if match_idx == -1:
-            raise attenuator.Error(
-                "Telnet command failed to return valid data")
+    if match_idx == -1:
+      raise attenuator.Error("Telnet command failed to return valid data")
 
-        ret_text = ret_text.decode()
-        ret_text = ret_text.strip(self.tx_cmd_separator +
-                                  self.rx_cmd_separator + self.prompt)
+    ret_text = ret_text.decode()
+    ret_text = ret_text.strip(self.tx_cmd_separator + self.rx_cmd_separator +
+                              self.prompt)
 
-        return ret_text
+    return ret_text
diff --git a/mobly/controllers/iperf_server.py b/mobly/controllers/iperf_server.py
index 4d01e17..19da297 100644
--- a/mobly/controllers/iperf_server.py
+++ b/mobly/controllers/iperf_server.py
@@ -24,106 +24,107 @@
 
 
 def create(configs):
-    results = []
-    for c in configs:
-        try:
-            results.append(IPerfServer(c, logging.log_path))
-        except:
-            pass
-    return results
+  results = []
+  for c in configs:
+    try:
+      results.append(IPerfServer(c, logging.log_path))
+    except:
+      pass
+  return results
 
 
 def destroy(objs):
-    for ipf in objs:
-        try:
-            ipf.stop()
-        except:
-            pass
+  for ipf in objs:
+    try:
+      ipf.stop()
+    except:
+      pass
 
 
 class IPerfResult(object):
-    def __init__(self, result_path):
-        try:
-            with io.open(result_path, 'r', encoding='utf-8') as f:
-                self.result = json.load(f)
-        except ValueError:
-            with io.open(result_path, 'r', encoding='utf-8') as f:
-                # Possibly a result from interrupted iperf run, skip first line
-                # and try again.
-                lines = f.readlines()[1:]
-                self.result = json.loads(''.join(lines))
 
-    def _has_data(self):
-        """Checks if the iperf result has valid throughput data.
+  def __init__(self, result_path):
+    try:
+      with io.open(result_path, 'r', encoding='utf-8') as f:
+        self.result = json.load(f)
+    except ValueError:
+      with io.open(result_path, 'r', encoding='utf-8') as f:
+        # Possibly a result from interrupted iperf run, skip first line
+        # and try again.
+        lines = f.readlines()[1:]
+        self.result = json.loads(''.join(lines))
+
+  def _has_data(self):
+    """Checks if the iperf result has valid throughput data.
 
         Returns:
             True if the result contains throughput data. False otherwise.
         """
-        return ('end' in self.result) and ('sum' in self.result["end"])
+    return ('end' in self.result) and ('sum' in self.result["end"])
 
-    def get_json(self):
-        """
+  def get_json(self):
+    """
         Returns:
             The raw json output from iPerf.
         """
-        return self.result
+    return self.result
 
-    @property
-    def error(self):
-        if 'error' not in self.result:
-            return None
-        return self.result['error']
+  @property
+  def error(self):
+    if 'error' not in self.result:
+      return None
+    return self.result['error']
 
-    @property
-    def avg_rate(self):
-        """Average receiving rate in MB/s over the entire run.
+  @property
+  def avg_rate(self):
+    """Average receiving rate in MB/s over the entire run.
 
         If the result is not from a success run, this property is None.
         """
-        if not self._has_data or 'sum' not in self.result['end']:
-            return None
-        bps = self.result['end']['sum']['bits_per_second']
-        return bps / 8 / 1024 / 1024
+    if not self._has_data or 'sum' not in self.result['end']:
+      return None
+    bps = self.result['end']['sum']['bits_per_second']
+    return bps / 8 / 1024 / 1024
 
-    @property
-    def avg_receive_rate(self):
-        """Average receiving rate in MB/s over the entire run. This data may
+  @property
+  def avg_receive_rate(self):
+    """Average receiving rate in MB/s over the entire run. This data may
         not exist if iperf was interrupted.
 
         If the result is not from a success run, this property is None.
         """
-        if not self._has_data or 'sum_received' not in self.result['end']:
-            return None
-        bps = self.result['end']['sum_received']['bits_per_second']
-        return bps / 8 / 1024 / 1024
+    if not self._has_data or 'sum_received' not in self.result['end']:
+      return None
+    bps = self.result['end']['sum_received']['bits_per_second']
+    return bps / 8 / 1024 / 1024
 
-    @property
-    def avg_send_rate(self):
-        """Average sending rate in MB/s over the entire run. This data may
+  @property
+  def avg_send_rate(self):
+    """Average sending rate in MB/s over the entire run. This data may
         not exist if iperf was interrupted.
 
         If the result is not from a success run, this property is None.
         """
-        if not self._has_data or 'sum_sent' not in self.result['end']:
-            return None
-        bps = self.result['end']['sum_sent']['bits_per_second']
-        return bps / 8 / 1024 / 1024
+    if not self._has_data or 'sum_sent' not in self.result['end']:
+      return None
+    bps = self.result['end']['sum_sent']['bits_per_second']
+    return bps / 8 / 1024 / 1024
 
 
 class IPerfServer():
-    """Class that handles iperf3 operations.
+  """Class that handles iperf3 operations.
     """
 
-    def __init__(self, port, log_path):
-        self.port = port
-        self.log_path = os.path.join(log_path, "iPerf{}".format(self.port))
-        self.iperf_str = "iperf3 -s -J -p {}".format(port)
-        self.iperf_process = None
-        self.log_files = []
-        self.started = False
+  def __init__(self, port, log_path):
+    self.port = port
+    self.log_path = os.path.join(log_path, "iPerf{}".format(self.port))
+    self.iperf_str = "iperf3 -s -J -p {}".format(port)
+    self.iperf_process = None
+    self.log_files = []
+    self.started = False
 
-    def start(self, extra_args="", tag=""):
-        """Starts iperf server on specified port.
+  def start(self, extra_args="", tag=""):
+    """Starts iperf server on specified port.
 
         Args:
             extra_args: A string representing extra arguments to start iperf
@@ -131,20 +132,20 @@
             tag: Appended to log file name to identify logs from different
                 iperf runs.
         """
-        if self.started:
-            return
-        utils.create_dir(self.log_path)
-        if tag:
-            tag = tag + ','
-        out_file_name = "IPerfServer,{},{}{}.log".format(
-            self.port, tag, len(self.log_files))
-        full_out_path = os.path.join(self.log_path, out_file_name)
-        cmd = '%s %s > %s' % (self.iperf_str, extra_args, full_out_path)
-        self.iperf_process = utils.start_standing_subprocess(cmd, shell=True)
-        self.log_files.append(full_out_path)
-        self.started = True
+    if self.started:
+      return
+    utils.create_dir(self.log_path)
+    if tag:
+      tag = tag + ','
+    out_file_name = "IPerfServer,{},{}{}.log".format(self.port, tag,
+                                                     len(self.log_files))
+    full_out_path = os.path.join(self.log_path, out_file_name)
+    cmd = '%s %s > %s' % (self.iperf_str, extra_args, full_out_path)
+    self.iperf_process = utils.start_standing_subprocess(cmd, shell=True)
+    self.log_files.append(full_out_path)
+    self.started = True
 
-    def stop(self):
-        if self.started:
-            utils.stop_standing_subprocess(self.iperf_process)
-            self.started = False
+  def stop(self):
+    if self.started:
+      utils.stop_standing_subprocess(self.iperf_process)
+      self.started = False
diff --git a/mobly/controllers/monsoon.py b/mobly/controllers/monsoon.py
index 951d928..dbfc400 100644
--- a/mobly/controllers/monsoon.py
+++ b/mobly/controllers/monsoon.py
@@ -42,23 +42,23 @@
 
 
 def create(configs):
-    if not configs:
-        raise MonsoonError('Configuration is empty, abort!')
-    elif not isinstance(configs, list):
-        raise MonsoonError('Configuration should be a list, abort!')
-    elif isinstance(configs[0], dict):
-        # Configs is a list of dicts.
-        objs = get_instances_with_configs(configs)
-    elif isinstance(configs[0], int):
-        # Configs is a list of ints representing serials.
-        objs = get_instances(configs)
-    else:
-        raise Exception('No valid config found in: %s' % configs)
-    return objs
+  if not configs:
+    raise MonsoonError('Configuration is empty, abort!')
+  elif not isinstance(configs, list):
+    raise MonsoonError('Configuration should be a list, abort!')
+  elif isinstance(configs[0], dict):
+    # Configs is a list of dicts.
+    objs = get_instances_with_configs(configs)
+  elif isinstance(configs[0], int):
+    # Configs is a list of ints representing serials.
+    objs = get_instances(configs)
+  else:
+    raise Exception('No valid config found in: %s' % configs)
+  return objs
 
 
 def get_instances_with_configs(configs):
-    """Create Monsoon instances from a list of dict configs.
+  """Create Monsoon instances from a list of dict configs.
 
     Each config should have the required key-value pair
     'serial': <an integer id>.
@@ -70,11 +70,11 @@
     Returns:
         A list of Monsoon objects.
     """
-    return get_instances([c['serial'] for c in configs])
+  return get_instances([c['serial'] for c in configs])
 
 
 def get_instances(serials):
-    """Create Monsoon instances from a list of serials.
+  """Create Monsoon instances from a list of serials.
 
     Args:
         serials: A list of Monsoon (integer) serials.
@@ -82,22 +82,22 @@
     Returns:
         A list of Monsoon objects.
     """
-    objs = []
-    for s in serials:
-        objs.append(Monsoon(serial=s))
-    return objs
+  objs = []
+  for s in serials:
+    objs.append(Monsoon(serial=s))
+  return objs
 
 
 def destroy(objs):
-    return
+  return
 
 
 class MonsoonError(mobly.signals.ControllerError):
-    """Raised for exceptions encountered in monsoon lib."""
+  """Raised for exceptions encountered in monsoon lib."""
 
 
 class MonsoonProxy(object):
-    """Class that directly talks to monsoon over serial.
+  """Class that directly talks to monsoon over serial.
 
     Provides a simple class to use the power meter, e.g.
 
@@ -112,8 +112,8 @@
         mon.StopDataCollection()
     """
 
-    def __init__(self, device=None, serialno=None, wait=1):
-        """Establish a connection to a Monsoon.
+  def __init__(self, device=None, serialno=None, wait=1):
+    """Establish a connection to a Monsoon.
 
         By default, opens the first available port, waiting if none are ready.
         A particular port can be specified with "device", or a particular
@@ -121,336 +121,334 @@
         its back). With wait=0, IOError is thrown if a device is not
         immediately available.
         """
-        self._coarse_ref = self._fine_ref = self._coarse_zero = 0
-        self._fine_zero = self._coarse_scale = self._fine_scale = 0
-        self._last_seq = 0
-        self.start_voltage = 0
-        self.serial = serialno
+    self._coarse_ref = self._fine_ref = self._coarse_zero = 0
+    self._fine_zero = self._coarse_scale = self._fine_scale = 0
+    self._last_seq = 0
+    self.start_voltage = 0
+    self.serial = serialno
 
-        if device:
-            self.ser = serial.Serial(device, timeout=1)
-            return
-        # Try all devices connected through USB virtual serial ports until we
-        # find one we can use.
-        while True:
-            for dev in os.listdir("/dev"):
-                prefix = "ttyACM"
-                # Prefix is different on Mac OS X.
-                if sys.platform == "darwin":
-                    prefix = "tty.usbmodem"
-                if not dev.startswith(prefix):
-                    continue
-                tmpname = "/tmp/monsoon.%s.%s" % (os.uname()[0], dev)
-                self._tempfile = io.open(tmpname, "w", encoding='utf-8')
-                try:
-                    os.chmod(tmpname, 0o666)
-                except OSError as e:
-                    pass
+    if device:
+      self.ser = serial.Serial(device, timeout=1)
+      return
+    # Try all devices connected through USB virtual serial ports until we
+    # find one we can use.
+    while True:
+      for dev in os.listdir("/dev"):
+        prefix = "ttyACM"
+        # Prefix is different on Mac OS X.
+        if sys.platform == "darwin":
+          prefix = "tty.usbmodem"
+        if not dev.startswith(prefix):
+          continue
+        tmpname = "/tmp/monsoon.%s.%s" % (os.uname()[0], dev)
+        self._tempfile = io.open(tmpname, "w", encoding='utf-8')
+        try:
+          os.chmod(tmpname, 0o666)
+        except OSError as e:
+          pass
 
-                try:  # use a lockfile to ensure exclusive access
-                    fcntl.lockf(self._tempfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
-                except IOError as e:
-                    logging.error("device %s is in use", dev)
-                    continue
+        try:  # use a lockfile to ensure exclusive access
+          fcntl.lockf(self._tempfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
+        except IOError as e:
+          logging.error("device %s is in use", dev)
+          continue
 
-                try:  # try to open the device
-                    self.ser = serial.Serial("/dev/%s" % dev, timeout=1)
-                    self.StopDataCollection()  # just in case
-                    self._FlushInput()  # discard stale input
-                    status = self.GetStatus()
-                except Exception as e:
-                    logging.exception("Error opening device %s: %s", dev, e)
-                    continue
+        try:  # try to open the device
+          self.ser = serial.Serial("/dev/%s" % dev, timeout=1)
+          self.StopDataCollection()  # just in case
+          self._FlushInput()  # discard stale input
+          status = self.GetStatus()
+        except Exception as e:
+          logging.exception("Error opening device %s: %s", dev, e)
+          continue
 
-                if not status:
-                    logging.error("no response from device %s", dev)
-                elif serialno and status["serialNumber"] != serialno:
-                    logging.error("Another device serial #%d seen on %s",
-                                  status["serialNumber"], dev)
-                else:
-                    self.start_voltage = status["voltage1"]
-                    return
+        if not status:
+          logging.error("no response from device %s", dev)
+        elif serialno and status["serialNumber"] != serialno:
+          logging.error("Another device serial #%d seen on %s",
+                        status["serialNumber"], dev)
+        else:
+          self.start_voltage = status["voltage1"]
+          return
 
-            self._tempfile = None
-            if not wait: raise IOError("No device found")
-            logging.info("Waiting for device...")
-            time.sleep(1)
+      self._tempfile = None
+      if not wait:
+        raise IOError("No device found")
+      logging.info("Waiting for device...")
+      time.sleep(1)
 
-    def GetStatus(self):
-        """Requests and waits for status.
+  def GetStatus(self):
+    """Requests and waits for status.
 
         Returns:
             status dictionary.
         """
-        # status packet format
-        STATUS_FORMAT = ">BBBhhhHhhhHBBBxBbHBHHHHBbbHHBBBbbbbbbbbbBH"
-        STATUS_FIELDS = [
-            "packetType",
-            "firmwareVersion",
-            "protocolVersion",
-            "mainFineCurrent",
-            "usbFineCurrent",
-            "auxFineCurrent",
-            "voltage1",
-            "mainCoarseCurrent",
-            "usbCoarseCurrent",
-            "auxCoarseCurrent",
-            "voltage2",
-            "outputVoltageSetting",
-            "temperature",
-            "status",
-            "leds",
-            "mainFineResistor",
-            "serialNumber",
-            "sampleRate",
-            "dacCalLow",
-            "dacCalHigh",
-            "powerUpCurrentLimit",
-            "runTimeCurrentLimit",
-            "powerUpTime",
-            "usbFineResistor",
-            "auxFineResistor",
-            "initialUsbVoltage",
-            "initialAuxVoltage",
-            "hardwareRevision",
-            "temperatureLimit",
-            "usbPassthroughMode",
-            "mainCoarseResistor",
-            "usbCoarseResistor",
-            "auxCoarseResistor",
-            "defMainFineResistor",
-            "defUsbFineResistor",
-            "defAuxFineResistor",
-            "defMainCoarseResistor",
-            "defUsbCoarseResistor",
-            "defAuxCoarseResistor",
-            "eventCode",
-            "eventData",
-        ]
+    # status packet format
+    STATUS_FORMAT = ">BBBhhhHhhhHBBBxBbHBHHHHBbbHHBBBbbbbbbbbbBH"
+    STATUS_FIELDS = [
+        "packetType",
+        "firmwareVersion",
+        "protocolVersion",
+        "mainFineCurrent",
+        "usbFineCurrent",
+        "auxFineCurrent",
+        "voltage1",
+        "mainCoarseCurrent",
+        "usbCoarseCurrent",
+        "auxCoarseCurrent",
+        "voltage2",
+        "outputVoltageSetting",
+        "temperature",
+        "status",
+        "leds",
+        "mainFineResistor",
+        "serialNumber",
+        "sampleRate",
+        "dacCalLow",
+        "dacCalHigh",
+        "powerUpCurrentLimit",
+        "runTimeCurrentLimit",
+        "powerUpTime",
+        "usbFineResistor",
+        "auxFineResistor",
+        "initialUsbVoltage",
+        "initialAuxVoltage",
+        "hardwareRevision",
+        "temperatureLimit",
+        "usbPassthroughMode",
+        "mainCoarseResistor",
+        "usbCoarseResistor",
+        "auxCoarseResistor",
+        "defMainFineResistor",
+        "defUsbFineResistor",
+        "defAuxFineResistor",
+        "defMainCoarseResistor",
+        "defUsbCoarseResistor",
+        "defAuxCoarseResistor",
+        "eventCode",
+        "eventData",
+    ]
 
-        self._SendStruct("BBB", 0x01, 0x00, 0x00)
-        while 1:  # Keep reading, discarding non-status packets
-            read_bytes = self._ReadPacket()
-            if not read_bytes:
-                return None
-            calsize = struct.calcsize(STATUS_FORMAT)
-            if len(read_bytes) != calsize or read_bytes[0] != 0x10:
-                logging.warning("Wanted status, dropped type=0x%02x, len=%d",
-                                read_bytes[0], len(read_bytes))
-                continue
-            status = dict(
-                zip(STATUS_FIELDS, struct.unpack(STATUS_FORMAT, read_bytes)))
-            p_type = status["packetType"]
-            if p_type != 0x10:
-                raise MonsoonError("Package type %s is not 0x10." % p_type)
-            for k in status.keys():
-                if k.endswith("VoltageSetting"):
-                    status[k] = 2.0 + status[k] * 0.01
-                elif k.endswith("FineCurrent"):
-                    pass  # needs calibration data
-                elif k.endswith("CoarseCurrent"):
-                    pass  # needs calibration data
-                elif k.startswith("voltage") or k.endswith("Voltage"):
-                    status[k] = status[k] * 0.000125
-                elif k.endswith("Resistor"):
-                    status[k] = 0.05 + status[k] * 0.0001
-                    if k.startswith("aux") or k.startswith("defAux"):
-                        status[k] += 0.05
-                elif k.endswith("CurrentLimit"):
-                    status[k] = 8 * (1023 - status[k]) / 1023.0
-            return status
+    self._SendStruct("BBB", 0x01, 0x00, 0x00)
+    while 1:  # Keep reading, discarding non-status packets
+      read_bytes = self._ReadPacket()
+      if not read_bytes:
+        return None
+      calsize = struct.calcsize(STATUS_FORMAT)
+      if len(read_bytes) != calsize or read_bytes[0] != 0x10:
+        logging.warning("Wanted status, dropped type=0x%02x, len=%d",
+                        read_bytes[0], len(read_bytes))
+        continue
+      status = dict(zip(STATUS_FIELDS, struct.unpack(STATUS_FORMAT,
+                                                     read_bytes)))
+      p_type = status["packetType"]
+      if p_type != 0x10:
+        raise MonsoonError("Package type %s is not 0x10." % p_type)
+      for k in status.keys():
+        if k.endswith("VoltageSetting"):
+          status[k] = 2.0 + status[k] * 0.01
+        elif k.endswith("FineCurrent"):
+          pass  # needs calibration data
+        elif k.endswith("CoarseCurrent"):
+          pass  # needs calibration data
+        elif k.startswith("voltage") or k.endswith("Voltage"):
+          status[k] = status[k] * 0.000125
+        elif k.endswith("Resistor"):
+          status[k] = 0.05 + status[k] * 0.0001
+          if k.startswith("aux") or k.startswith("defAux"):
+            status[k] += 0.05
+        elif k.endswith("CurrentLimit"):
+          status[k] = 8 * (1023 - status[k]) / 1023.0
+      return status
 
-    def RampVoltage(self, start, end):
-        v = start
-        if v < 3.0: v = 3.0  # protocol doesn't support lower than this
-        while (v < end):
-            self.SetVoltage(v)
-            v += .1
-            time.sleep(.1)
-        self.SetVoltage(end)
+  def RampVoltage(self, start, end):
+    v = start
+    if v < 3.0:
+      v = 3.0  # protocol doesn't support lower than this
+    while (v < end):
+      self.SetVoltage(v)
+      v += .1
+      time.sleep(.1)
+    self.SetVoltage(end)
 
-    def SetVoltage(self, v):
-        """Set the output voltage, 0 to disable.
+  def SetVoltage(self, v):
+    """Set the output voltage, 0 to disable.
         """
-        if v == 0:
-            self._SendStruct("BBB", 0x01, 0x01, 0x00)
-        else:
-            self._SendStruct("BBB", 0x01, 0x01, int((v - 2.0) * 100))
+    if v == 0:
+      self._SendStruct("BBB", 0x01, 0x01, 0x00)
+    else:
+      self._SendStruct("BBB", 0x01, 0x01, int((v - 2.0) * 100))
 
-    def GetVoltage(self):
-        """Get the output voltage.
+  def GetVoltage(self):
+    """Get the output voltage.
 
         Returns:
             Current Output Voltage (in unit of v).
         """
-        return self.GetStatus()["outputVoltageSetting"]
+    return self.GetStatus()["outputVoltageSetting"]
 
-    def SetMaxCurrent(self, i):
-        """Set the max output current.
+  def SetMaxCurrent(self, i):
+    """Set the max output current.
         """
-        if i < 0 or i > 8:
-            raise MonsoonError(("Target max current %sA, is out of acceptable "
-                                "range [0, 8].") % i)
-        val = 1023 - int((i / 8) * 1023)
-        self._SendStruct("BBB", 0x01, 0x0a, val & 0xff)
-        self._SendStruct("BBB", 0x01, 0x0b, val >> 8)
+    if i < 0 or i > 8:
+      raise MonsoonError(("Target max current %sA, is out of acceptable "
+                          "range [0, 8].") % i)
+    val = 1023 - int((i / 8) * 1023)
+    self._SendStruct("BBB", 0x01, 0x0a, val & 0xff)
+    self._SendStruct("BBB", 0x01, 0x0b, val >> 8)
 
-    def SetMaxPowerUpCurrent(self, i):
-        """Set the max power up current.
+  def SetMaxPowerUpCurrent(self, i):
+    """Set the max power up current.
         """
-        if i < 0 or i > 8:
-            raise MonsoonError(("Target max current %sA, is out of acceptable "
-                                "range [0, 8].") % i)
-        val = 1023 - int((i / 8) * 1023)
-        self._SendStruct("BBB", 0x01, 0x08, val & 0xff)
-        self._SendStruct("BBB", 0x01, 0x09, val >> 8)
+    if i < 0 or i > 8:
+      raise MonsoonError(("Target max current %sA, is out of acceptable "
+                          "range [0, 8].") % i)
+    val = 1023 - int((i / 8) * 1023)
+    self._SendStruct("BBB", 0x01, 0x08, val & 0xff)
+    self._SendStruct("BBB", 0x01, 0x09, val >> 8)
 
-    def SetUsbPassthrough(self, val):
-        """Set the USB passthrough mode: 0 = off, 1 = on,  2 = auto.
+  def SetUsbPassthrough(self, val):
+    """Set the USB passthrough mode: 0 = off, 1 = on,  2 = auto.
         """
-        self._SendStruct("BBB", 0x01, 0x10, val)
+    self._SendStruct("BBB", 0x01, 0x10, val)
 
-    def GetUsbPassthrough(self):
-        """Get the USB passthrough mode: 0 = off, 1 = on,  2 = auto.
+  def GetUsbPassthrough(self):
+    """Get the USB passthrough mode: 0 = off, 1 = on,  2 = auto.
 
         Returns:
             Current USB passthrough mode.
         """
-        return self.GetStatus()["usbPassthroughMode"]
+    return self.GetStatus()["usbPassthroughMode"]
 
-    def StartDataCollection(self):
-        """Tell the device to start collecting and sending measurement data.
+  def StartDataCollection(self):
+    """Tell the device to start collecting and sending measurement data.
         """
-        self._SendStruct("BBB", 0x01, 0x1b, 0x01)  # Mystery command
-        self._SendStruct("BBBBBBB", 0x02, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8)
+    self._SendStruct("BBB", 0x01, 0x1b, 0x01)  # Mystery command
+    self._SendStruct("BBBBBBB", 0x02, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe8)
 
-    def StopDataCollection(self):
-        """Tell the device to stop collecting measurement data.
+  def StopDataCollection(self):
+    """Tell the device to stop collecting measurement data.
         """
-        self._SendStruct("BB", 0x03, 0x00)  # stop
+    self._SendStruct("BB", 0x03, 0x00)  # stop
 
-    def CollectData(self):
-        """Return some current samples. Call StartDataCollection() first.
+  def CollectData(self):
+    """Return some current samples. Call StartDataCollection() first.
         """
-        while 1:  # loop until we get data or a timeout
-            _bytes = self._ReadPacket()
-            if not _bytes:
-                return None
-            if len(_bytes) < 4 + 8 + 1 or _bytes[0] < 0x20 or _bytes[0] > 0x2F:
-                logging.warning("Wanted data, dropped type=0x%02x, len=%d",
-                                _bytes[0], len(_bytes))
-                continue
+    while 1:  # loop until we get data or a timeout
+      _bytes = self._ReadPacket()
+      if not _bytes:
+        return None
+      if len(_bytes) < 4 + 8 + 1 or _bytes[0] < 0x20 or _bytes[0] > 0x2F:
+        logging.warning("Wanted data, dropped type=0x%02x, len=%d", _bytes[0],
+                        len(_bytes))
+        continue
 
-            seq, _type, x, y = struct.unpack("BBBB", _bytes[:4])
-            data = [
-                struct.unpack(">hhhh", _bytes[x:x + 8])
-                for x in range(4,
-                               len(_bytes) - 8, 8)
-            ]
+      seq, _type, x, y = struct.unpack("BBBB", _bytes[:4])
+      data = [
+          struct.unpack(">hhhh", _bytes[x:x + 8])
+          for x in range(4,
+                         len(_bytes) - 8, 8)
+      ]
 
-            if self._last_seq and seq & 0xF != (self._last_seq + 1) & 0xF:
-                logging.warning("Data sequence skipped, lost packet?")
-            self._last_seq = seq
+      if self._last_seq and seq & 0xF != (self._last_seq + 1) & 0xF:
+        logging.warning("Data sequence skipped, lost packet?")
+      self._last_seq = seq
 
-            if _type == 0:
-                if not self._coarse_scale or not self._fine_scale:
-                    logging.warning(
-                        "Waiting for calibration, dropped data packet.")
-                    continue
-                out = []
-                for main, usb, aux, voltage in data:
-                    if main & 1:
-                        coarse = ((main & ~1) - self._coarse_zero)
-                        out.append(coarse * self._coarse_scale)
-                    else:
-                        out.append((main - self._fine_zero) * self._fine_scale)
-                return out
-            elif _type == 1:
-                self._fine_zero = data[0][0]
-                self._coarse_zero = data[1][0]
-            elif _type == 2:
-                self._fine_ref = data[0][0]
-                self._coarse_ref = data[1][0]
-            else:
-                logging.warning("Discarding data packet type=0x%02x", _type)
-                continue
+      if _type == 0:
+        if not self._coarse_scale or not self._fine_scale:
+          logging.warning("Waiting for calibration, dropped data packet.")
+          continue
+        out = []
+        for main, usb, aux, voltage in data:
+          if main & 1:
+            coarse = ((main & ~1) - self._coarse_zero)
+            out.append(coarse * self._coarse_scale)
+          else:
+            out.append((main - self._fine_zero) * self._fine_scale)
+        return out
+      elif _type == 1:
+        self._fine_zero = data[0][0]
+        self._coarse_zero = data[1][0]
+      elif _type == 2:
+        self._fine_ref = data[0][0]
+        self._coarse_ref = data[1][0]
+      else:
+        logging.warning("Discarding data packet type=0x%02x", _type)
+        continue
 
-            # See http://wiki/Main/MonsoonProtocol for details on these values.
-            if self._coarse_ref != self._coarse_zero:
-                self._coarse_scale = 2.88 / (self._coarse_ref -
-                                             self._coarse_zero)
-            if self._fine_ref != self._fine_zero:
-                self._fine_scale = 0.0332 / (self._fine_ref - self._fine_zero)
+      # See http://wiki/Main/MonsoonProtocol for details on these values.
+      if self._coarse_ref != self._coarse_zero:
+        self._coarse_scale = 2.88 / (self._coarse_ref - self._coarse_zero)
+      if self._fine_ref != self._fine_zero:
+        self._fine_scale = 0.0332 / (self._fine_ref - self._fine_zero)
 
-    def _SendStruct(self, fmt, *args):
-        """Pack a struct (without length or checksum) and send it.
+  def _SendStruct(self, fmt, *args):
+    """Pack a struct (without length or checksum) and send it.
         """
-        data = struct.pack(fmt, *args)
-        data_len = len(data) + 1
-        checksum = (data_len + sum(bytearray(data))) % 256
-        out = struct.pack("B", data_len) + data + struct.pack("B", checksum)
-        self.ser.write(out)
+    data = struct.pack(fmt, *args)
+    data_len = len(data) + 1
+    checksum = (data_len + sum(bytearray(data))) % 256
+    out = struct.pack("B", data_len) + data + struct.pack("B", checksum)
+    self.ser.write(out)
 
-    def _ReadPacket(self):
-        """Read a single data record as a string (without length or checksum).
+  def _ReadPacket(self):
+    """Read a single data record as a string (without length or checksum).
         """
-        len_char = self.ser.read(1)
-        if not len_char:
-            logging.error("Reading from serial port timed out.")
-            return None
+    len_char = self.ser.read(1)
+    if not len_char:
+      logging.error("Reading from serial port timed out.")
+      return None
 
-        data_len = ord(len_char)
-        if not data_len:
-            return ""
-        result = self.ser.read(int(data_len))
-        result = bytearray(result)
-        if len(result) != data_len:
-            logging.error("Length mismatch, expected %d bytes, got %d bytes.",
-                          data_len, len(result))
-            return None
-        body = result[:-1]
-        checksum = (sum(struct.unpack("B" * len(body), body)) + data_len) % 256
-        if result[-1] != checksum:
-            logging.error(
-                "Invalid checksum from serial port! Expected %s, got %s",
-                hex(checksum), hex(result[-1]))
-            return None
-        return result[:-1]
+    data_len = ord(len_char)
+    if not data_len:
+      return ""
+    result = self.ser.read(int(data_len))
+    result = bytearray(result)
+    if len(result) != data_len:
+      logging.error("Length mismatch, expected %d bytes, got %d bytes.",
+                    data_len, len(result))
+      return None
+    body = result[:-1]
+    checksum = (sum(struct.unpack("B" * len(body), body)) + data_len) % 256
+    if result[-1] != checksum:
+      logging.error("Invalid checksum from serial port! Expected %s, got %s",
+                    hex(checksum), hex(result[-1]))
+      return None
+    return result[:-1]
 
-    def _FlushInput(self):
-        """ Flush all read data until no more available. """
-        self.ser.flush()
-        flushed = 0
-        while True:
-            ready_r, ready_w, ready_x = select.select([self.ser], [],
-                                                      [self.ser], 0)
-            if len(ready_x) > 0:
-                logging.error("Exception from serial port.")
-                return None
-            elif len(ready_r) > 0:
-                flushed += 1
-                self.ser.read(1)  # This may cause underlying buffering.
-                self.ser.flush()  # Flush the underlying buffer too.
-            else:
-                break
-        # if flushed > 0:
-        #     logging.info("dropped >%d bytes" % flushed)
+  def _FlushInput(self):
+    """ Flush all read data until no more available. """
+    self.ser.flush()
+    flushed = 0
+    while True:
+      ready_r, ready_w, ready_x = select.select([self.ser], [], [self.ser], 0)
+      if len(ready_x) > 0:
+        logging.error("Exception from serial port.")
+        return None
+      elif len(ready_r) > 0:
+        flushed += 1
+        self.ser.read(1)  # This may cause underlying buffering.
+        self.ser.flush()  # Flush the underlying buffer too.
+      else:
+        break
+    # if flushed > 0:
+    #     logging.info("dropped >%d bytes" % flushed)
 
 
 class MonsoonData(object):
-    """A class for reporting power measurement data from monsoon.
+  """A class for reporting power measurement data from monsoon.
 
     Data means the measured current value in Amps.
     """
-    # Number of digits for long rounding.
-    lr = 8
-    # Number of digits for short rounding
-    sr = 6
-    # Delimiter for writing multiple MonsoonData objects to text file.
-    delimiter = "\n\n==========\n\n"
+  # Number of digits for long rounding.
+  lr = 8
+  # Number of digits for short rounding
+  sr = 6
+  # Delimiter for writing multiple MonsoonData objects to text file.
+  delimiter = "\n\n==========\n\n"
 
-    def __init__(self, data_points, timestamps, hz, voltage, offset=0):
-        """Instantiates a MonsoonData object.
+  def __init__(self, data_points, timestamps, hz, voltage, offset=0):
+    """Instantiates a MonsoonData object.
 
         Args:
             data_points: A list of current values in Amp (float).
@@ -460,48 +458,48 @@
             offset: The number of initial data points to discard
                 in calculations.
         """
-        self._data_points = data_points
-        self._timestamps = timestamps
-        self.offset = offset
-        num_of_data_pt = len(self._data_points)
-        if self.offset >= num_of_data_pt:
-            raise MonsoonError(
-                ("Offset number (%d) must be smaller than the "
-                 "number of data points (%d).") % (offset, num_of_data_pt))
-        self.data_points = self._data_points[self.offset:]
-        self.timestamps = self._timestamps[self.offset:]
-        self.hz = hz
-        self.voltage = voltage
-        self.tag = None
-        self._validate_data()
+    self._data_points = data_points
+    self._timestamps = timestamps
+    self.offset = offset
+    num_of_data_pt = len(self._data_points)
+    if self.offset >= num_of_data_pt:
+      raise MonsoonError(
+          ("Offset number (%d) must be smaller than the "
+           "number of data points (%d).") % (offset, num_of_data_pt))
+    self.data_points = self._data_points[self.offset:]
+    self.timestamps = self._timestamps[self.offset:]
+    self.hz = hz
+    self.voltage = voltage
+    self.tag = None
+    self._validate_data()
 
-    @property
-    def average_current(self):
-        """Average current in the unit of mA.
+  @property
+  def average_current(self):
+    """Average current in the unit of mA.
         """
-        len_data_pt = len(self.data_points)
-        if len_data_pt == 0:
-            return 0
-        cur = sum(self.data_points) * 1000 / len_data_pt
-        return round(cur, self.sr)
+    len_data_pt = len(self.data_points)
+    if len_data_pt == 0:
+      return 0
+    cur = sum(self.data_points) * 1000 / len_data_pt
+    return round(cur, self.sr)
 
-    @property
-    def total_charge(self):
-        """Total charged used in the unit of mAh.
+  @property
+  def total_charge(self):
+    """Total charged used in the unit of mAh.
         """
-        charge = (sum(self.data_points) / self.hz) * 1000 / 3600
-        return round(charge, self.sr)
+    charge = (sum(self.data_points) / self.hz) * 1000 / 3600
+    return round(charge, self.sr)
 
-    @property
-    def total_power(self):
-        """Total power used.
+  @property
+  def total_power(self):
+    """Total power used.
         """
-        power = self.average_current * self.voltage
-        return round(power, self.sr)
+    power = self.average_current * self.voltage
+    return round(power, self.sr)
 
-    @staticmethod
-    def from_string(data_str):
-        """Creates a MonsoonData object from a string representation generated
+  @staticmethod
+  def from_string(data_str):
+    """Creates a MonsoonData object from a string representation generated
         by __str__.
 
         Args:
@@ -510,36 +508,35 @@
         Returns:
             A MonsoonData object.
         """
-        lines = data_str.strip().split('\n')
-        err_msg = ("Invalid input string format. Is this string generated by "
-                   "MonsoonData class?")
-        conditions = [
-            len(lines) <= 4, "Average Current:" not in lines[1],
-            "Voltage: " not in lines[2], "Total Power: " not in lines[3],
-            "samples taken at " not in lines[4],
-            lines[5] != "Time" + ' ' * 7 + "Amp"
-        ]
-        if any(conditions):
-            raise MonsoonError(err_msg)
-        hz_str = lines[4].split()[2]
-        hz = int(hz_str[:-2])
-        voltage_str = lines[2].split()[1]
-        voltage = int(voltage_str[:-1])
-        lines = lines[6:]
-        t = []
-        v = []
-        for l in lines:
-            try:
-                timestamp, value = l.split(' ')
-                t.append(int(timestamp))
-                v.append(float(value))
-            except ValueError:
-                raise MonsoonError(err_msg)
-        return MonsoonData(v, t, hz, voltage)
+    lines = data_str.strip().split('\n')
+    err_msg = ("Invalid input string format. Is this string generated by "
+               "MonsoonData class?")
+    conditions = [
+        len(lines) <= 4, "Average Current:" not in lines[1], "Voltage: "
+        not in lines[2], "Total Power: " not in lines[3], "samples taken at "
+        not in lines[4], lines[5] != "Time" + ' ' * 7 + "Amp"
+    ]
+    if any(conditions):
+      raise MonsoonError(err_msg)
+    hz_str = lines[4].split()[2]
+    hz = int(hz_str[:-2])
+    voltage_str = lines[2].split()[1]
+    voltage = int(voltage_str[:-1])
+    lines = lines[6:]
+    t = []
+    v = []
+    for l in lines:
+      try:
+        timestamp, value = l.split(' ')
+        t.append(int(timestamp))
+        v.append(float(value))
+      except ValueError:
+        raise MonsoonError(err_msg)
+    return MonsoonData(v, t, hz, voltage)
 
-    @staticmethod
-    def save_to_text_file(monsoon_data, file_path):
-        """Save multiple MonsoonData objects to a text file.
+  @staticmethod
+  def save_to_text_file(monsoon_data, file_path):
+    """Save multiple MonsoonData objects to a text file.
 
         Args:
             monsoon_data: A list of MonsoonData objects to write to a text
@@ -547,18 +544,18 @@
             file_path: The full path of the file to save to, including the file
                 name.
         """
-        if not monsoon_data:
-            raise MonsoonError("Attempting to write empty Monsoon data to "
-                               "file, abort")
-        utils.create_dir(os.path.dirname(file_path))
-        with io.open(file_path, 'w', encoding='utf-8') as f:
-            for md in monsoon_data:
-                f.write(str(md))
-                f.write(MonsoonData.delimiter)
+    if not monsoon_data:
+      raise MonsoonError("Attempting to write empty Monsoon data to "
+                         "file, abort")
+    utils.create_dir(os.path.dirname(file_path))
+    with io.open(file_path, 'w', encoding='utf-8') as f:
+      for md in monsoon_data:
+        f.write(str(md))
+        f.write(MonsoonData.delimiter)
 
-    @staticmethod
-    def from_text_file(file_path):
-        """Load MonsoonData objects from a text file generated by
+  @staticmethod
+  def from_text_file(file_path):
+    """Load MonsoonData objects from a text file generated by
         MonsoonData.save_to_text_file.
 
         Args:
@@ -568,23 +565,23 @@
         Returns:
             A list of MonsoonData objects.
         """
-        results = []
-        with io.open(file_path, 'r', encoding='utf-8') as f:
-            data_strs = f.read().split(MonsoonData.delimiter)
-            for data_str in data_strs:
-                results.append(MonsoonData.from_string(data_str))
-        return results
+    results = []
+    with io.open(file_path, 'r', encoding='utf-8') as f:
+      data_strs = f.read().split(MonsoonData.delimiter)
+      for data_str in data_strs:
+        results.append(MonsoonData.from_string(data_str))
+    return results
 
-    def _validate_data(self):
-        """Verifies that the data points contained in the class are valid.
+  def _validate_data(self):
+    """Verifies that the data points contained in the class are valid.
         """
-        msg = "Error! Expected {} timestamps, found {}.".format(
-            len(self._data_points), len(self._timestamps))
-        if len(self._data_points) != len(self._timestamps):
-            raise MonsoonError(msg)
+    msg = "Error! Expected {} timestamps, found {}.".format(
+        len(self._data_points), len(self._timestamps))
+    if len(self._data_points) != len(self._timestamps):
+      raise MonsoonError(msg)
 
-    def update_offset(self, new_offset):
-        """Updates how many data points to skip in caculations.
+  def update_offset(self, new_offset):
+    """Updates how many data points to skip in caculations.
 
         Always use this function to update offset instead of directly setting
         self.offset.
@@ -592,23 +589,23 @@
         Args:
             new_offset: The new offset.
         """
-        self.offset = new_offset
-        self.data_points = self._data_points[self.offset:]
-        self.timestamps = self._timestamps[self.offset:]
+    self.offset = new_offset
+    self.data_points = self._data_points[self.offset:]
+    self.timestamps = self._timestamps[self.offset:]
 
-    def get_data_with_timestamps(self):
-        """Returns the data points with timestamps.
+  def get_data_with_timestamps(self):
+    """Returns the data points with timestamps.
 
         Returns:
             A list of tuples in the format of (timestamp, data)
         """
-        result = []
-        for t, d in zip(self.timestamps, self.data_points):
-            result.append(t, round(d, self.lr))
-        return result
+    result = []
+    for t, d in zip(self.timestamps, self.data_points):
+      result.append(t, round(d, self.lr))
+    return result
 
-    def get_average_record(self, n):
-        """Returns a list of average current numbers, each representing the
+  def get_average_record(self, n):
+    """Returns a list of average current numbers, each representing the
         average over the last n data points.
 
         Args:
@@ -617,109 +614,109 @@
         Returns:
             A list of average current values.
         """
-        history_deque = collections.deque()
-        averages = []
-        for d in self.data_points:
-            history_deque.appendleft(d)
-            if len(history_deque) > n:
-                history_deque.pop()
-            avg = sum(history_deque) / len(history_deque)
-            averages.append(round(avg, self.lr))
-        return averages
+    history_deque = collections.deque()
+    averages = []
+    for d in self.data_points:
+      history_deque.appendleft(d)
+      if len(history_deque) > n:
+        history_deque.pop()
+      avg = sum(history_deque) / len(history_deque)
+      averages.append(round(avg, self.lr))
+    return averages
 
-    def _header(self):
-        strs = [""]
-        if self.tag:
-            strs.append(self.tag)
-        else:
-            strs.append("Monsoon Measurement Data")
-        strs.append("Average Current: {}mA.".format(self.average_current))
-        strs.append("Voltage: {}V.".format(self.voltage))
-        strs.append("Total Power: {}mW.".format(self.total_power))
-        strs.append(
-            ("{} samples taken at {}Hz, with an offset of {} samples.").format(
-                len(self._data_points), self.hz, self.offset))
-        return "\n".join(strs)
+  def _header(self):
+    strs = [""]
+    if self.tag:
+      strs.append(self.tag)
+    else:
+      strs.append("Monsoon Measurement Data")
+    strs.append("Average Current: {}mA.".format(self.average_current))
+    strs.append("Voltage: {}V.".format(self.voltage))
+    strs.append("Total Power: {}mW.".format(self.total_power))
+    strs.append(
+        ("{} samples taken at {}Hz, with an offset of {} samples.").format(
+            len(self._data_points), self.hz, self.offset))
+    return "\n".join(strs)
 
-    def __len__(self):
-        return len(self.data_points)
+  def __len__(self):
+    return len(self.data_points)
 
-    def __str__(self):
-        strs = []
-        strs.append(self._header())
-        strs.append("Time" + ' ' * 7 + "Amp")
-        for t, d in zip(self.timestamps, self.data_points):
-            strs.append("{} {}".format(t, round(d, self.sr)))
-        return "\n".join(strs)
+  def __str__(self):
+    strs = []
+    strs.append(self._header())
+    strs.append("Time" + ' ' * 7 + "Amp")
+    for t, d in zip(self.timestamps, self.data_points):
+      strs.append("{} {}".format(t, round(d, self.sr)))
+    return "\n".join(strs)
 
-    def __repr__(self):
-        return self._header()
+  def __repr__(self):
+    return self._header()
 
 
 class Monsoon(object):
-    """The wrapper class for test scripts to interact with monsoon.
+  """The wrapper class for test scripts to interact with monsoon.
     """
 
-    def __init__(self, *args, **kwargs):
-        serial = kwargs["serial"]
-        device = None
-        self.log = logging.getLogger()
-        if "device" in kwargs:
-            device = kwargs["device"]
-        self.mon = MonsoonProxy(serialno=serial, device=device)
-        self.dut = None
+  def __init__(self, *args, **kwargs):
+    serial = kwargs["serial"]
+    device = None
+    self.log = logging.getLogger()
+    if "device" in kwargs:
+      device = kwargs["device"]
+    self.mon = MonsoonProxy(serialno=serial, device=device)
+    self.dut = None
 
-    def attach_device(self, dut):
-        """Attach the controller object for the Device Under Test (DUT)
+  def attach_device(self, dut):
+    """Attach the controller object for the Device Under Test (DUT)
         physically attached to the Monsoon box.
 
         Args:
             dut: A controller object representing the device being powered by
                 this Monsoon box.
         """
-        self.dut = dut
+    self.dut = dut
 
-    def set_voltage(self, volt, ramp=False):
-        """Sets the output voltage of monsoon.
+  def set_voltage(self, volt, ramp=False):
+    """Sets the output voltage of monsoon.
 
         Args:
             volt: Voltage to set the output to.
             ramp: If true, the output voltage will be increased gradually to
                 prevent tripping Monsoon overvoltage.
         """
-        if ramp:
-            self.mon.RampVoltage(self.mon.start_voltage, volt)
-        else:
-            self.mon.SetVoltage(volt)
+    if ramp:
+      self.mon.RampVoltage(self.mon.start_voltage, volt)
+    else:
+      self.mon.SetVoltage(volt)
 
-    def set_max_current(self, cur):
-        """Sets monsoon's max output current.
+  def set_max_current(self, cur):
+    """Sets monsoon's max output current.
 
         Args:
             cur: The max current in A.
         """
-        self.mon.SetMaxCurrent(cur)
+    self.mon.SetMaxCurrent(cur)
 
-    def set_max_init_current(self, cur):
-        """Sets the max power-up/initial current.
+  def set_max_init_current(self, cur):
+    """Sets the max power-up/initial current.
 
         Args:
             cur: The max initial current allowed in mA.
         """
-        self.mon.SetMaxPowerUpCurrent(cur)
+    self.mon.SetMaxPowerUpCurrent(cur)
 
-    @property
-    def status(self):
-        """Gets the status params of monsoon.
+  @property
+  def status(self):
+    """Gets the status params of monsoon.
 
         Returns:
             A dictionary where each key-value pair represents a monsoon status
             param.
         """
-        return self.mon.GetStatus()
+    return self.mon.GetStatus()
 
-    def take_samples(self, sample_hz, sample_num, sample_offset=0, live=False):
-        """Take samples of the current value supplied by monsoon.
+  def take_samples(self, sample_hz, sample_num, sample_offset=0, live=False):
+    """Take samples of the current value supplied by monsoon.
 
         This is the actual measurement for power consumption. This function
         blocks until the number of samples requested has been fulfilled.
@@ -735,78 +732,78 @@
             A MonsoonData object representing the data obtained in this
             sampling. None if sampling is unsuccessful.
         """
-        sys.stdout.flush()
-        voltage = self.mon.GetVoltage()
-        self.log.info("Taking samples at %dhz for %ds, voltage %.2fv.",
-                      sample_hz, (sample_num / sample_hz), voltage)
-        sample_num += sample_offset
-        # Make sure state is normal
-        self.mon.StopDataCollection()
-        status = self.mon.GetStatus()
-        native_hz = status["sampleRate"] * 1000
+    sys.stdout.flush()
+    voltage = self.mon.GetVoltage()
+    self.log.info("Taking samples at %dhz for %ds, voltage %.2fv.", sample_hz,
+                  (sample_num / sample_hz), voltage)
+    sample_num += sample_offset
+    # Make sure state is normal
+    self.mon.StopDataCollection()
+    status = self.mon.GetStatus()
+    native_hz = status["sampleRate"] * 1000
 
-        # Collect and average samples as specified
-        self.mon.StartDataCollection()
+    # Collect and average samples as specified
+    self.mon.StartDataCollection()
 
-        # In case sample_hz doesn't divide native_hz exactly, use this
-        # invariant: 'offset' = (consumed samples) * sample_hz -
-        # (emitted samples) * native_hz
-        # This is the error accumulator in a variation of Bresenham's
-        # algorithm.
-        emitted = offset = 0
-        collected = []
-        # past n samples for rolling average
-        history_deque = collections.deque()
-        current_values = []
-        timestamps = []
+    # In case sample_hz doesn't divide native_hz exactly, use this
+    # invariant: 'offset' = (consumed samples) * sample_hz -
+    # (emitted samples) * native_hz
+    # This is the error accumulator in a variation of Bresenham's
+    # algorithm.
+    emitted = offset = 0
+    collected = []
+    # past n samples for rolling average
+    history_deque = collections.deque()
+    current_values = []
+    timestamps = []
 
-        try:
-            last_flush = time.time()
-            while emitted < sample_num or sample_num == -1:
-                # The number of raw samples to consume before emitting the next
-                # output
-                need = int((native_hz - offset + sample_hz - 1) / sample_hz)
-                if need > len(collected):  # still need more input samples
-                    samples = self.mon.CollectData()
-                    if not samples:
-                        break
-                    collected.extend(samples)
-                else:
-                    # Have enough data, generate output samples.
-                    # Adjust for consuming 'need' input samples.
-                    offset += need * sample_hz
-                    # maybe multiple, if sample_hz > native_hz
-                    while offset >= native_hz:
-                        # TODO(angli): Optimize "collected" operations.
-                        this_sample = sum(collected[:need]) / need
-                        this_time = int(time.time())
-                        timestamps.append(this_time)
-                        if live:
-                            self.log.info("%s %s", this_time, this_sample)
-                        current_values.append(this_sample)
-                        sys.stdout.flush()
-                        offset -= native_hz
-                        emitted += 1  # adjust for emitting 1 output sample
-                    collected = collected[need:]
-                    now = time.time()
-                    if now - last_flush >= 0.99:  # flush every second
-                        sys.stdout.flush()
-                        last_flush = now
-        except Exception as e:
-            pass
-        self.mon.StopDataCollection()
-        try:
-            return MonsoonData(current_values,
-                               timestamps,
-                               sample_hz,
-                               voltage,
-                               offset=sample_offset)
-        except:
-            return None
+    try:
+      last_flush = time.time()
+      while emitted < sample_num or sample_num == -1:
+        # The number of raw samples to consume before emitting the next
+        # output
+        need = int((native_hz - offset + sample_hz - 1) / sample_hz)
+        if need > len(collected):  # still need more input samples
+          samples = self.mon.CollectData()
+          if not samples:
+            break
+          collected.extend(samples)
+        else:
+          # Have enough data, generate output samples.
+          # Adjust for consuming 'need' input samples.
+          offset += need * sample_hz
+          # maybe multiple, if sample_hz > native_hz
+          while offset >= native_hz:
+            # TODO(angli): Optimize "collected" operations.
+            this_sample = sum(collected[:need]) / need
+            this_time = int(time.time())
+            timestamps.append(this_time)
+            if live:
+              self.log.info("%s %s", this_time, this_sample)
+            current_values.append(this_sample)
+            sys.stdout.flush()
+            offset -= native_hz
+            emitted += 1  # adjust for emitting 1 output sample
+          collected = collected[need:]
+          now = time.time()
+          if now - last_flush >= 0.99:  # flush every second
+            sys.stdout.flush()
+            last_flush = now
+    except Exception as e:
+      pass
+    self.mon.StopDataCollection()
+    try:
+      return MonsoonData(current_values,
+                         timestamps,
+                         sample_hz,
+                         voltage,
+                         offset=sample_offset)
+    except:
+      return None
 
-    @timeout_decorator.timeout(60, use_signals=False)
-    def usb(self, state):
-        """Sets the monsoon's USB passthrough mode. This is specific to the
+  @timeout_decorator.timeout(60, use_signals=False)
+  def usb(self, state):
+    """Sets the monsoon's USB passthrough mode. This is specific to the
         USB port in front of the monsoon box which connects to the powered
         device, NOT the USB that is used to talk to the monsoon itself.
 
@@ -821,27 +818,27 @@
         Returns:
             True if the state is legal and set. False otherwise.
         """
-        state_lookup = {"off": 0, "on": 1, "auto": 2}
-        state = state.lower()
-        if state in state_lookup:
-            current_state = self.mon.GetUsbPassthrough()
-            while (current_state != state_lookup[state]):
-                self.mon.SetUsbPassthrough(state_lookup[state])
-                time.sleep(1)
-                current_state = self.mon.GetUsbPassthrough()
-            return True
-        return False
+    state_lookup = {"off": 0, "on": 1, "auto": 2}
+    state = state.lower()
+    if state in state_lookup:
+      current_state = self.mon.GetUsbPassthrough()
+      while (current_state != state_lookup[state]):
+        self.mon.SetUsbPassthrough(state_lookup[state])
+        time.sleep(1)
+        current_state = self.mon.GetUsbPassthrough()
+      return True
+    return False
 
-    def _check_dut(self):
-        """Verifies there is a DUT attached to the monsoon.
+  def _check_dut(self):
+    """Verifies there is a DUT attached to the monsoon.
 
         This should be called in the functions that operate the DUT.
         """
-        if not self.dut:
-            raise MonsoonError("Need to attach the device before using it.")
+    if not self.dut:
+      raise MonsoonError("Need to attach the device before using it.")
 
-    def measure_power(self, hz, duration, tag, offset=30):
-        """Measure power consumption of the attached device.
+  def measure_power(self, hz, duration, tag, offset=30):
+    """Measure power consumption of the attached device.
 
         Because it takes some time for the device to calm down after the usb
         connection is cut, an offset is set for each measurement. The default
@@ -856,26 +853,25 @@
         Returns:
             A MonsoonData object with the measured power data.
         """
-        num = duration * hz
-        oset = offset * hz
-        data = None
-        self.usb("auto")
-        time.sleep(1)
-        with self.dut.handle_usb_disconnect():
-            time.sleep(1)
-            try:
-                data = self.take_samples(hz, num, sample_offset=oset)
-                if not data:
-                    raise MonsoonError(
-                        "No data was collected in measurement %s." % tag)
-                data.tag = tag
-                self.dut.log.info("Measurement summary: %s", repr(data))
-                return data
-            finally:
-                self.mon.StopDataCollection()
-                self.log.info("Finished taking samples, reconnecting to dut.")
-                self.usb("on")
-                self.dut.adb.wait_for_device(timeout=DEFAULT_TIMEOUT_USB_ON)
-                # Wait for device to come back online.
-                time.sleep(10)
-                self.dut.log.info("Dut reconnected.")
+    num = duration * hz
+    oset = offset * hz
+    data = None
+    self.usb("auto")
+    time.sleep(1)
+    with self.dut.handle_usb_disconnect():
+      time.sleep(1)
+      try:
+        data = self.take_samples(hz, num, sample_offset=oset)
+        if not data:
+          raise MonsoonError("No data was collected in measurement %s." % tag)
+        data.tag = tag
+        self.dut.log.info("Measurement summary: %s", repr(data))
+        return data
+      finally:
+        self.mon.StopDataCollection()
+        self.log.info("Finished taking samples, reconnecting to dut.")
+        self.usb("on")
+        self.dut.adb.wait_for_device(timeout=DEFAULT_TIMEOUT_USB_ON)
+        # Wait for device to come back online.
+        time.sleep(10)
+        self.dut.log.info("Dut reconnected.")
diff --git a/mobly/controllers/sniffer.py b/mobly/controllers/sniffer.py
index 2408212..445c221 100644
--- a/mobly/controllers/sniffer.py
+++ b/mobly/controllers/sniffer.py
@@ -19,7 +19,7 @@
 
 
 def create(configs):
-    """Initializes the sniffer structures based on the JSON configuration. The
+  """Initializes the sniffer structures based on the JSON configuration. The
     expected keys are:
 
         * Type: A first-level type of sniffer. Planned to be 'local' for
@@ -32,77 +32,77 @@
             capture. The keys must be one of the Sniffer.CONFIG_KEY_*
             values.
     """
-    objs = []
-    for c in configs:
-        sniffer_type = c["Type"]
-        sniffer_subtype = c["SubType"]
-        interface = c["Interface"]
-        base_configs = c["BaseConfigs"]
-        module_name = "mobly.controllers.sniffer_lib.{}.{}".format(
-            sniffer_type, sniffer_subtype)
-        module = importlib.import_module(module_name)
-        objs.append(
-            module.Sniffer(interface,
-                           logging.getLogger(),
-                           base_configs=base_configs))
-    return objs
+  objs = []
+  for c in configs:
+    sniffer_type = c["Type"]
+    sniffer_subtype = c["SubType"]
+    interface = c["Interface"]
+    base_configs = c["BaseConfigs"]
+    module_name = "mobly.controllers.sniffer_lib.{}.{}".format(
+        sniffer_type, sniffer_subtype)
+    module = importlib.import_module(module_name)
+    objs.append(
+        module.Sniffer(interface,
+                       logging.getLogger(),
+                       base_configs=base_configs))
+  return objs
 
 
 def destroy(objs):
-    """Destroys the sniffers and terminates any ongoing capture sessions.
+  """Destroys the sniffers and terminates any ongoing capture sessions.
     """
-    for sniffer in objs:
-        try:
-            sniffer.stop_capture()
-        except SnifferError:
-            pass
+  for sniffer in objs:
+    try:
+      sniffer.stop_capture()
+    except SnifferError:
+      pass
 
 
 class SnifferError(Exception):
-    """This is the Exception class defined for all errors generated by
+  """This is the Exception class defined for all errors generated by
     Sniffer-related modules.
     """
-    pass
+  pass
 
 
 class InvalidDataError(Exception):
-    """This exception is thrown when invalid configuration data is passed
+  """This exception is thrown when invalid configuration data is passed
     to a method.
     """
-    pass
+  pass
 
 
 class ExecutionError(SnifferError):
-    """This exception is thrown when trying to configure the capture device
+  """This exception is thrown when trying to configure the capture device
     or when trying to execute the capture operation.
 
     When this exception is seen, it is possible that the sniffer module is run
     without sudo (for local sniffers) or keys are out-of-date (for remote
     sniffers).
     """
-    pass
+  pass
 
 
 class InvalidOperationError(SnifferError):
-    """Certain methods may only be accessed when the instance upon which they
+  """Certain methods may only be accessed when the instance upon which they
     are invoked is in a certain state. This indicates that the object is not
     in the correct state for a method to be called.
     """
-    pass
+  pass
 
 
 class Sniffer(object):
-    """This class defines an object representing a sniffer.
+  """This class defines an object representing a sniffer.
 
     The object defines the generic behavior of sniffers - irrespective of how
     they are implemented, or where they are located: on the local machine or on
     the remote machine.
     """
 
-    CONFIG_KEY_CHANNEL = "channel"
+  CONFIG_KEY_CHANNEL = "channel"
 
-    def __init__(self, interface, logger, base_configs=None):
-        """The constructor for the Sniffer. It constructs a sniffer and
+  def __init__(self, interface, logger, base_configs=None):
+    """The constructor for the Sniffer. It constructs a sniffer and
         configures it to be ready for capture.
 
         Args:
@@ -121,60 +121,60 @@
             NoPermissionError: if an error occurs while configuring the
                 sniffer.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def get_descriptor(self):
-        """This function returns a string describing the sniffer. The specific
+  def get_descriptor(self):
+    """This function returns a string describing the sniffer. The specific
         string (and its format) is up to each derived sniffer type.
 
         Returns:
             A string describing the sniffer.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def get_type(self):
-        """This function returns the type of the sniffer.
+  def get_type(self):
+    """This function returns the type of the sniffer.
 
         Returns:
             The type (string) of the sniffer. Corresponds to the 'Type' key of
             the sniffer configuration.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def get_subtype(self):
-        """This function returns the sub-type of the sniffer.
+  def get_subtype(self):
+    """This function returns the sub-type of the sniffer.
 
         Returns:
             The sub-type (string) of the sniffer. Corresponds to the 'SubType'
             key of the sniffer configuration.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def get_interface(self):
-        """This function returns The interface used to configure the sniffer,
+  def get_interface(self):
+    """This function returns The interface used to configure the sniffer,
         e.g. 'wlan0'.
 
         Returns:
             The interface (string) used to configure the sniffer. Corresponds to
             the 'Interface' key of the sniffer configuration.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def get_capture_file(self):
-        """The sniffer places a capture in the logger directory. This function
+  def get_capture_file(self):
+    """The sniffer places a capture in the logger directory. This function
         enables the caller to obtain the path of that capture.
 
         Returns:
             The full path of the current or last capture.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def start_capture(self,
-                      override_configs=None,
-                      additional_args=None,
-                      duration=None,
-                      packet_count=None):
-        """This function starts a capture which is saved to the specified file
+  def start_capture(self,
+                    override_configs=None,
+                    additional_args=None,
+                    duration=None,
+                    packet_count=None):
+    """This function starts a capture which is saved to the specified file
         path.
 
         Depending on the type/subtype and configuration of the sniffer the
@@ -220,10 +220,10 @@
             NoPermissionError: if an error occurs while configuring and running
                 the sniffer.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def stop_capture(self):
-        """This function stops a capture and guarantees that the capture is
+  def stop_capture(self):
+    """This function stops a capture and guarantees that the capture is
         saved to the capture file configured during the start_capture() method.
         Depending on the type of the sniffer the file may previously contain
         partial results (e.g. for a local sniffer) or may not exist until the
@@ -239,10 +239,10 @@
             NoPermissionError: No permission when trying to stop a capture
                 and save the capture file.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def wait_for_capture(self, timeout=None):
-        """This function waits for a capture to terminate and guarantees that
+  def wait_for_capture(self, timeout=None):
+    """This function waits for a capture to terminate and guarantees that
         the capture is saved to the capture file configured during the
         start_capture() method. Depending on the type of the sniffer the file
         may previously contain partial results (e.g. for a local sniffer) or
@@ -265,31 +265,31 @@
             NoPermissionError: No permission when trying to stop a capture and
                 save the capture file.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
 
 class ActiveCaptureContext(object):
-    """This class defines an object representing an active sniffer capture.
+  """This class defines an object representing an active sniffer capture.
 
     The object is returned by a Sniffer.start_capture() command and terminates
     the capture when the 'with' clause exits. It is syntactic sugar for
     try/finally.
     """
 
-    _sniffer = None
-    _timeout = None
+  _sniffer = None
+  _timeout = None
 
-    def __init__(self, sniffer, timeout=None):
-        self._sniffer = sniffer
-        self._timeout = timeout
+  def __init__(self, sniffer, timeout=None):
+    self._sniffer = sniffer
+    self._timeout = timeout
 
-    def __enter__(self):
-        pass
+  def __enter__(self):
+    pass
 
-    def __exit__(self, type, value, traceback):
-        if self._sniffer is not None:
-            if self._timeout is None:
-                self._sniffer.stop_capture()
-            else:
-                self._sniffer.wait_for_capture(self._timeout)
-        self._sniffer = None
+  def __exit__(self, type, value, traceback):
+    if self._sniffer is not None:
+      if self._timeout is None:
+        self._sniffer.stop_capture()
+      else:
+        self._sniffer.wait_for_capture(self._timeout)
+    self._sniffer = None
diff --git a/mobly/controllers/sniffer_lib/local/local_base.py b/mobly/controllers/sniffer_lib/local/local_base.py
index 441d60b..a9fb673 100644
--- a/mobly/controllers/sniffer_lib/local/local_base.py
+++ b/mobly/controllers/sniffer_lib/local/local_base.py
@@ -29,132 +29,130 @@
 
 
 class SnifferLocalBase(sniffer.Sniffer):
-    """This class defines the common behaviors of WLAN sniffers running on
+  """This class defines the common behaviors of WLAN sniffers running on
     WLAN interfaces of the local machine.
 
     Specific mechanisms to capture packets over the local WLAN interfaces are
     implemented by sub-classes of this class - i.e. it is not a final class.
     """
 
-    def __init__(self, interface, logger, base_configs=None):
-        """See base class documentation
+  def __init__(self, interface, logger, base_configs=None):
+    """See base class documentation
         """
-        self._base_configs = None
-        self._capture_file_path = ""
-        self._interface = ""
-        self._logger = logger
-        self._process = None
-        self._temp_capture_file_path = ""
+    self._base_configs = None
+    self._capture_file_path = ""
+    self._interface = ""
+    self._logger = logger
+    self._process = None
+    self._temp_capture_file_path = ""
 
-        if interface == "":
-            raise sniffer.InvalidDataError("Empty interface provided")
-        self._interface = interface
-        self._base_configs = base_configs
+    if interface == "":
+      raise sniffer.InvalidDataError("Empty interface provided")
+    self._interface = interface
+    self._base_configs = base_configs
 
-        try:
-            subprocess.check_call(['ifconfig', self._interface, 'down'])
-            subprocess.check_call(
-                ['iwconfig', self._interface, 'mode', 'monitor'])
-            subprocess.check_call(['ifconfig', self._interface, 'up'])
-        except Exception as err:
-            raise sniffer.ExecutionError(err)
+    try:
+      subprocess.check_call(['ifconfig', self._interface, 'down'])
+      subprocess.check_call(['iwconfig', self._interface, 'mode', 'monitor'])
+      subprocess.check_call(['ifconfig', self._interface, 'up'])
+    except Exception as err:
+      raise sniffer.ExecutionError(err)
 
-    def get_interface(self):
-        """See base class documentation
+  def get_interface(self):
+    """See base class documentation
         """
-        return self._interface
+    return self._interface
 
-    def get_type(self):
-        """See base class documentation
+  def get_type(self):
+    """See base class documentation
         """
-        return "local"
+    return "local"
 
-    def get_capture_file(self):
-        return self._capture_file_path
+  def get_capture_file(self):
+    return self._capture_file_path
 
-    def _pre_capture_config(self, override_configs=None):
-        """Utility function which configures the wireless interface per the
+  def _pre_capture_config(self, override_configs=None):
+    """Utility function which configures the wireless interface per the
         specified configurations. Operation is performed before every capture
         start using baseline configurations (specified when sniffer initialized)
         and override configurations specified here.
         """
-        final_configs = {}
-        if self._base_configs:
-            final_configs.update(self._base_configs)
-        if override_configs:
-            final_configs.update(override_configs)
+    final_configs = {}
+    if self._base_configs:
+      final_configs.update(self._base_configs)
+    if override_configs:
+      final_configs.update(override_configs)
 
-        if sniffer.Sniffer.CONFIG_KEY_CHANNEL in final_configs:
-            try:
-                subprocess.check_call([
-                    'iwconfig', self._interface, 'channel',
-                    str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL])
-                ])
-            except Exception as err:
-                raise sniffer.ExecutionError(err)
+    if sniffer.Sniffer.CONFIG_KEY_CHANNEL in final_configs:
+      try:
+        subprocess.check_call([
+            'iwconfig', self._interface, 'channel',
+            str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL])
+        ])
+      except Exception as err:
+        raise sniffer.ExecutionError(err)
 
-    def _get_command_line(self,
-                          additional_args=None,
-                          duration=None,
-                          packet_count=None):
-        """Utility function to be implemented by every child class - which
+  def _get_command_line(self,
+                        additional_args=None,
+                        duration=None,
+                        packet_count=None):
+    """Utility function to be implemented by every child class - which
         are the concrete sniffer classes. Each sniffer-specific class should
         derive the command line to execute its sniffer based on the specified
         arguments.
         """
-        raise NotImplementedError("Base class should not be called directly!")
+    raise NotImplementedError("Base class should not be called directly!")
 
-    def _post_process(self):
-        """Utility function which is executed after a capture is done. It
+  def _post_process(self):
+    """Utility function which is executed after a capture is done. It
         moves the capture file to the requested location.
         """
-        self._process = None
-        shutil.move(self._temp_capture_file_path, self._capture_file_path)
+    self._process = None
+    shutil.move(self._temp_capture_file_path, self._capture_file_path)
 
-    def start_capture(self,
-                      override_configs=None,
-                      additional_args=None,
-                      duration=None,
-                      packet_count=None):
-        """See base class documentation
+  def start_capture(self,
+                    override_configs=None,
+                    additional_args=None,
+                    duration=None,
+                    packet_count=None):
+    """See base class documentation
         """
-        if self._process is not None:
-            raise sniffer.InvalidOperationError(
-                "Trying to start a sniff while another is still running!")
-        capture_dir = os.path.join(self._logger.log_path,
-                                   "Sniffer-{}".format(self._interface))
-        os.makedirs(capture_dir, exist_ok=True)
-        self._capture_file_path = os.path.join(
-            capture_dir,
-            "capture_{}.pcap".format(logger.get_log_file_timestamp()))
+    if self._process is not None:
+      raise sniffer.InvalidOperationError(
+          "Trying to start a sniff while another is still running!")
+    capture_dir = os.path.join(self._logger.log_path,
+                               "Sniffer-{}".format(self._interface))
+    os.makedirs(capture_dir, exist_ok=True)
+    self._capture_file_path = os.path.join(
+        capture_dir, "capture_{}.pcap".format(logger.get_log_file_timestamp()))
 
-        self._pre_capture_config(override_configs)
-        _, self._temp_capture_file_path = tempfile.mkstemp(suffix=".pcap")
+    self._pre_capture_config(override_configs)
+    _, self._temp_capture_file_path = tempfile.mkstemp(suffix=".pcap")
 
-        cmd = self._get_command_line(additional_args=additional_args,
-                                     duration=duration,
-                                     packet_count=packet_count)
+    cmd = self._get_command_line(additional_args=additional_args,
+                                 duration=duration,
+                                 packet_count=packet_count)
 
-        self._process = utils.start_standing_subprocess(cmd)
-        return sniffer.ActiveCaptureContext(self, duration)
+    self._process = utils.start_standing_subprocess(cmd)
+    return sniffer.ActiveCaptureContext(self, duration)
 
-    def stop_capture(self):
-        """See base class documentation
+  def stop_capture(self):
+    """See base class documentation
         """
-        if self._process is None:
-            raise sniffer.InvalidOperationError(
-                "Trying to stop a non-started process")
-        utils.stop_standing_subprocess(self._process)
-        self._post_process()
+    if self._process is None:
+      raise sniffer.InvalidOperationError(
+          "Trying to stop a non-started process")
+    utils.stop_standing_subprocess(self._process)
+    self._post_process()
 
-    def wait_for_capture(self, timeout=None):
-        """See base class documentation
+  def wait_for_capture(self, timeout=None):
+    """See base class documentation
         """
-        if self._process is None:
-            raise sniffer.InvalidOperationError(
-                "Trying to wait on a non-started process")
-        try:
-            utils.wait_for_standing_subprocess(self._process, timeout)
-            self._post_process()
-        except subprocess.TimeoutExpired:
-            self.stop_capture()
+    if self._process is None:
+      raise sniffer.InvalidOperationError(
+          "Trying to wait on a non-started process")
+    try:
+      utils.wait_for_standing_subprocess(self._process, timeout)
+      self._post_process()
+    except subprocess.TimeoutExpired:
+      self.stop_capture()
diff --git a/mobly/controllers/sniffer_lib/local/tcpdump.py b/mobly/controllers/sniffer_lib/local/tcpdump.py
index b06e0db..053d4eb 100644
--- a/mobly/controllers/sniffer_lib/local/tcpdump.py
+++ b/mobly/controllers/sniffer_lib/local/tcpdump.py
@@ -18,39 +18,39 @@
 
 
 class Sniffer(local_base.SnifferLocalBase):
-    """This class defines a sniffer which uses tcpdump as its back-end
+  """This class defines a sniffer which uses tcpdump as its back-end
     """
 
-    def __init__(self, config_path, logger, base_configs=None):
-        """See base class documentation
+  def __init__(self, config_path, logger, base_configs=None):
+    """See base class documentation
         """
-        self._executable_path = None
+    self._executable_path = None
 
-        super().__init__(config_path, logger, base_configs=base_configs)
+    super().__init__(config_path, logger, base_configs=base_configs)
 
-        self._executable_path = shutil.which("tcpdump")
-        if self._executable_path is None:
-            raise sniffer.SnifferError(
-                "Cannot find a path to the 'tcpdump' executable")
+    self._executable_path = shutil.which("tcpdump")
+    if self._executable_path is None:
+      raise sniffer.SnifferError(
+          "Cannot find a path to the 'tcpdump' executable")
 
-    def get_descriptor(self):
-        """See base class documentation
+  def get_descriptor(self):
+    """See base class documentation
         """
-        return "local-tcpdump-{}".format(self._interface)
+    return "local-tcpdump-{}".format(self._interface)
 
-    def get_subtype(self):
-        """See base class documentation
+  def get_subtype(self):
+    """See base class documentation
         """
-        return "tcpdump"
+    return "tcpdump"
 
-    def _get_command_line(self,
-                          additional_args=None,
-                          duration=None,
-                          packet_count=None):
-        cmd = "{} -i {} -w {}".format(self._executable_path, self._interface,
-                                      self._temp_capture_file_path)
-        if packet_count is not None:
-            cmd = "{} -c {}".format(cmd, packet_count)
-        if additional_args is not None:
-            cmd = "{} {}".format(cmd, additional_args)
-        return cmd
+  def _get_command_line(self,
+                        additional_args=None,
+                        duration=None,
+                        packet_count=None):
+    cmd = "{} -i {} -w {}".format(self._executable_path, self._interface,
+                                  self._temp_capture_file_path)
+    if packet_count is not None:
+      cmd = "{} -c {}".format(cmd, packet_count)
+    if additional_args is not None:
+      cmd = "{} {}".format(cmd, additional_args)
+    return cmd
diff --git a/mobly/controllers/sniffer_lib/local/tshark.py b/mobly/controllers/sniffer_lib/local/tshark.py
index 18fe67a..a22d5f0 100644
--- a/mobly/controllers/sniffer_lib/local/tshark.py
+++ b/mobly/controllers/sniffer_lib/local/tshark.py
@@ -18,43 +18,42 @@
 
 
 class Sniffer(local_base.SnifferLocalBase):
-    """This class defines a sniffer which uses tshark as its back-end
+  """This class defines a sniffer which uses tshark as its back-end
     """
 
-    def __init__(self, config_path, logger, base_configs=None):
-        """See base class documentation
+  def __init__(self, config_path, logger, base_configs=None):
+    """See base class documentation
         """
-        self._executable_path = None
+    self._executable_path = None
 
-        super().__init__(config_path, logger, base_configs=base_configs)
+    super().__init__(config_path, logger, base_configs=base_configs)
 
-        self._executable_path = (shutil.which("tshark")
-                                 or shutil.which("/usr/local/bin/tshark"))
-        if self._executable_path is None:
-            raise sniffer.SnifferError(
-                "Cannot find a path to the 'tshark' "
-                "executable (or to '/usr/local/bin/tshark')")
+    self._executable_path = (shutil.which("tshark") or
+                             shutil.which("/usr/local/bin/tshark"))
+    if self._executable_path is None:
+      raise sniffer.SnifferError("Cannot find a path to the 'tshark' "
+                                 "executable (or to '/usr/local/bin/tshark')")
 
-    def get_descriptor(self):
-        """See base class documentation
+  def get_descriptor(self):
+    """See base class documentation
         """
-        return "local-tshark-{}-ch{}".format(self._interface)
+    return "local-tshark-{}-ch{}".format(self._interface)
 
-    def get_subtype(self):
-        """See base class documentation
+  def get_subtype(self):
+    """See base class documentation
         """
-        return "tshark"
+    return "tshark"
 
-    def _get_command_line(self,
-                          additional_args=None,
-                          duration=None,
-                          packet_count=None):
-        cmd = "{} -i {} -w {}".format(self._executable_path, self._interface,
-                                      self._temp_capture_file_path)
-        if duration is not None:
-            cmd = "{} -a duration:{}".format(cmd, duration)
-        if packet_count is not None:
-            cmd = "{} -c {}".format(cmd, packet_count)
-        if additional_args is not None:
-            cmd = "{} {}".format(cmd, additional_args)
-        return cmd
+  def _get_command_line(self,
+                        additional_args=None,
+                        duration=None,
+                        packet_count=None):
+    cmd = "{} -i {} -w {}".format(self._executable_path, self._interface,
+                                  self._temp_capture_file_path)
+    if duration is not None:
+      cmd = "{} -a duration:{}".format(cmd, duration)
+    if packet_count is not None:
+      cmd = "{} -c {}".format(cmd, packet_count)
+    if additional_args is not None:
+      cmd = "{} {}".format(cmd, additional_args)
+    return cmd
diff --git a/mobly/expects.py b/mobly/expects.py
index d95a83c..8125775 100644
--- a/mobly/expects.py
+++ b/mobly/expects.py
@@ -69,8 +69,7 @@
       error: Exception or signals.ExceptionRecord, the error to add.
     """
     self._count += 1
-    self._record.add_error('expect@%s+%s' % (time.time(), self._count),
-                 error)
+    self._record.add_error('expect@%s+%s' % (time.time(), self._count), error)
 
 
 def expect_true(condition, msg, extras=None):
@@ -131,7 +130,7 @@
     asserts.assert_equal(first, second, msg, extras)
   except signals.TestSignal as e:
     logging.exception('Expected %s equals to %s, but they are not.', first,
-              second)
+                      second)
     recorder.add_error(e)
 
 
diff --git a/mobly/logger.py b/mobly/logger.py
index 4204b71..782af60 100644
--- a/mobly/logger.py
+++ b/mobly/logger.py
@@ -31,34 +31,34 @@
 # length seems to be lower.
 WINDOWS_MAX_FILENAME_LENGTH = 237
 WINDOWS_RESERVED_CHARACTERS_REPLACEMENTS = {
-  '<':
-  '-',
-  '>':
-  '-',
-  ':':
-  '-',
-  '"':
-  '_',
-  '/':
-  '_',
-  '\\':
-  '_',
-  '|':
-  ',',
-  '?':
-  ',',
-  '*':
-  ',',
-  # Integer zero (i.e. NUL) is not a valid character.
-  # While integers 1-31 are also usually valid, they aren't sanitized because
-  # they are situationally valid.
-  chr(0):
-  '0',
+    '<':
+        '-',
+    '>':
+        '-',
+    ':':
+        '-',
+    '"':
+        '_',
+    '/':
+        '_',
+    '\\':
+        '_',
+    '|':
+        ',',
+    '?':
+        ',',
+    '*':
+        ',',
+    # Integer zero (i.e. NUL) is not a valid character.
+    # While integers 1-31 are also usually valid, they aren't sanitized because
+    # they are situationally valid.
+    chr(0):
+        '0',
 }
 # Note, although the documentation does not specify as such, COM0 and LPT0 are
 # also invalid/reserved filenames.
 WINDOWS_RESERVED_FILENAME_REGEX = re.compile(
-  r'^(CON|PRN|AUX|NUL|(COM|LPT)[0-9])(\.[^.]*)?$', re.IGNORECASE)
+    r'^(CON|PRN|AUX|NUL|(COM|LPT)[0-9])(\.[^.]*)?$', re.IGNORECASE)
 WINDOWS_RESERVED_FILENAME_PREFIX = 'mobly_'
 
 log_line_format = '%(asctime)s.%(msecs).03d %(levelname)s %(message)s'
@@ -199,11 +199,11 @@
   f_formatter = logging.Formatter(log_line_format, log_line_time_format)
   # Write logger output to files
   fh_info = logging.FileHandler(
-    os.path.join(log_path, records.OUTPUT_FILE_INFO_LOG))
+      os.path.join(log_path, records.OUTPUT_FILE_INFO_LOG))
   fh_info.setFormatter(f_formatter)
   fh_info.setLevel(logging.INFO)
   fh_debug = logging.FileHandler(
-    os.path.join(log_path, records.OUTPUT_FILE_DEBUG_LOG))
+      os.path.join(log_path, records.OUTPUT_FILE_DEBUG_LOG))
   fh_debug.setFormatter(f_formatter)
   fh_debug.setLevel(logging.DEBUG)
   log.addHandler(ch)
@@ -286,8 +286,7 @@
       # This is kind of a degrenerate case where the extension is
       # extremely long, in which case, just return the truncated filename.
       return filename[:max_length]
-    return '.'.join(
-      [filename[:max_length - len(extension) - 1], extension])
+    return '.'.join([filename[:max_length - len(extension) - 1], extension])
   else:
     return filename[:max_length]
 
@@ -318,8 +317,7 @@
   new_filename_chars = []
   for char in filename:
     if char in WINDOWS_RESERVED_CHARACTERS_REPLACEMENTS:
-      new_filename_chars.append(
-        WINDOWS_RESERVED_CHARACTERS_REPLACEMENTS[char])
+      new_filename_chars.append(WINDOWS_RESERVED_CHARACTERS_REPLACEMENTS[char])
     else:
       new_filename_chars.append(char)
   filename = ''.join(new_filename_chars)
diff --git a/mobly/records.py b/mobly/records.py
index 0edba15..5b9e0a2 100644
--- a/mobly/records.py
+++ b/mobly/records.py
@@ -57,6 +57,7 @@
     raise ValueError('UID cannot be None.')
 
   def decorate(test_func):
+
     @functools.wraps(test_func)
     def wrapper(*args, **kwargs):
       return test_func(*args, **kwargs)
@@ -158,10 +159,10 @@
         # Use safe_dump here to avoid language-specific tags in final
         # output.
         yaml.safe_dump(new_content,
-                 f,
-                 explicit_start=True,
-                 allow_unicode=True,
-                 indent=4)
+                       f,
+                       explicit_start=True,
+                       allow_unicode=True,
+                       indent=4)
 
 
 class TestResultEnums(object):
@@ -243,7 +244,7 @@
       _, _, exc_traceback = sys.exc_info()
     if exc_traceback:
       self.stacktrace = ''.join(
-        traceback.format_exception(e.__class__, e, exc_traceback))
+          traceback.format_exception(e.__class__, e, exc_traceback))
     # Populate fields based on the type of the termination signal.
     if self.is_test_signal:
       self._set_details(e.details)
@@ -266,9 +267,8 @@
       else:
         # We should never hit this in Py3, if this happens, record
         # an encoded version of the content for users to handle.
-        logging.error(
-          'Unable to decode "%s" in Py3, encoding in utf-8.',
-          content)
+        logging.error('Unable to decode "%s" in Py3, encoding in utf-8.',
+                      content)
         self.details = content.encode('utf-8')
 
   def to_dict(self):
@@ -460,7 +460,7 @@
       self.result = TestResultEnums.TEST_RESULT_ERROR
     if position in self.extra_errors:
       raise Error('An exception is already recorded with position "%s",'
-            ' cannot reuse.' % position)
+                  ' cannot reuse.' % position)
     if isinstance(e, ExceptionRecord):
       self.extra_errors[position] = e
     else:
@@ -493,8 +493,7 @@
     d[TestResultEnums.RECORD_EXTRAS] = self.extras
     d[TestResultEnums.RECORD_DETAILS] = self.details
     d[TestResultEnums.RECORD_EXTRA_ERRORS] = {
-      key: value.to_dict()
-      for (key, value) in self.extra_errors.items()
+        key: value.to_dict() for (key, value) in self.extra_errors.items()
     }
     d[TestResultEnums.RECORD_STACKTRACE] = self.stacktrace
     return d
@@ -539,7 +538,7 @@
     """
     if not isinstance(r, TestResult):
       raise TypeError('Operand %s of type %s is not a TestResult.' %
-              (r, type(r)))
+                      (r, type(r)))
     sum_result = TestResult()
     for name in sum_result.__dict__:
       r_value = getattr(r, name)
diff --git a/mobly/runtime_test_info.py b/mobly/runtime_test_info.py
index 90a780a..eba7482 100644
--- a/mobly/runtime_test_info.py
+++ b/mobly/runtime_test_info.py
@@ -41,7 +41,7 @@
     self._record = record
     self._signature = '%s-%s' % (test_name, record.begin_time)
     self._output_dir_path = utils.abs_path(
-      os.path.join(log_path, self._signature))
+        os.path.join(log_path, self._signature))
 
   @property
   def name(self):
diff --git a/mobly/signals.py b/mobly/signals.py
index cc16d86..3583aba 100644
--- a/mobly/signals.py
+++ b/mobly/signals.py
@@ -39,7 +39,7 @@
       self.extras = extras
     except TypeError:
       raise TestSignalError('Extras must be json serializable. %s '
-                  'is not.' % extras)
+                            'is not.' % extras)
 
   def __str__(self):
     return 'Details=%s, Extras=%s' % (self.details, self.extras)
diff --git a/mobly/suite_runner.py b/mobly/suite_runner.py
index ea870e6..cc9e40d 100644
--- a/mobly/suite_runner.py
+++ b/mobly/suite_runner.py
@@ -56,18 +56,18 @@
   # Parse cli args.
   parser = argparse.ArgumentParser(description='Mobly Suite Executable.')
   parser.add_argument('-c',
-            '--config',
-            type=str,
-            required=True,
-            metavar='<PATH>',
-            help='Path to the test configuration file.')
+                      '--config',
+                      type=str,
+                      required=True,
+                      metavar='<PATH>',
+                      help='Path to the test configuration file.')
   parser.add_argument(
-    '--tests',
-    '--test_case',
-    nargs='+',
-    type=str,
-    metavar='[ClassA[.test_a] ClassB[.test_b] ...]',
-    help='A list of test classes and optional tests to execute.')
+      '--tests',
+      '--test_case',
+      nargs='+',
+      type=str,
+      metavar='[ClassA[.test_a] ClassB[.test_b] ...]',
+      help='A list of test classes and optional tests to execute.')
   if not argv:
     argv = sys.argv[1:]
   args = parser.parse_args(argv)
@@ -78,8 +78,8 @@
   for test_class in test_classes:
     if not issubclass(test_class, base_test.BaseTestClass):
       logging.error(
-        'Test class %s does not extend '
-        'mobly.base_test.BaseTestClass', test_class)
+          'Test class %s does not extend '
+          'mobly.base_test.BaseTestClass', test_class)
       sys.exit(1)
 
   # Find the full list of tests to execute
@@ -98,8 +98,7 @@
       except signals.TestAbortAll:
         pass
       except:
-        logging.exception('Exception when executing %s.',
-                  config.testbed_name)
+        logging.exception('Exception when executing %s.', config.testbed_name)
         ok = False
   if not ok:
     sys.exit(1)
diff --git a/mobly/test_runner.py b/mobly/test_runner.py
index fbae843..6b32bf9 100644
--- a/mobly/test_runner.py
+++ b/mobly/test_runner.py
@@ -64,8 +64,7 @@
     _print_test_names(test_class)
     sys.exit(0)
   # Load test config file.
-  test_configs = config_parser.load_test_config_file(args.config,
-                             args.test_bed)
+  test_configs = config_parser.load_test_config_file(args.config, args.test_bed)
   # Parse test specifiers if exist.
   tests = None
   if args.tests:
@@ -74,7 +73,7 @@
   ok = True
   for config in test_configs:
     runner = TestRunner(log_dir=config.log_path,
-              testbed_name=config.testbed_name)
+                        testbed_name=config.testbed_name)
     with runner.mobly_logger():
       runner.add_test_class(config, test_class, tests)
       try:
@@ -83,8 +82,7 @@
       except signals.TestAbortAll:
         pass
       except:
-        logging.exception('Exception when executing %s.',
-                  config.testbed_name)
+        logging.exception('Exception when executing %s.', config.testbed_name)
         ok = False
   if not ok:
     sys.exit(1)
@@ -109,28 +107,28 @@
   parser = argparse.ArgumentParser(description='Mobly Test Executable.')
   group = parser.add_mutually_exclusive_group(required=True)
   group.add_argument('-c',
-             '--config',
-             type=str,
-             metavar='<PATH>',
-             help='Path to the test configuration file.')
+                     '--config',
+                     type=str,
+                     metavar='<PATH>',
+                     help='Path to the test configuration file.')
   group.add_argument(
-    '-l',
-    '--list_tests',
-    action='store_true',
-    help='Print the names of the tests defined in a script without '
-    'executing them.')
+      '-l',
+      '--list_tests',
+      action='store_true',
+      help='Print the names of the tests defined in a script without '
+      'executing them.')
   parser.add_argument('--tests',
-            '--test_case',
-            nargs='+',
-            type=str,
-            metavar='[test_a test_b...]',
-            help='A list of tests in the test class to execute.')
+                      '--test_case',
+                      nargs='+',
+                      type=str,
+                      metavar='[test_a test_b...]',
+                      help='A list of tests in the test class to execute.')
   parser.add_argument('-tb',
-            '--test_bed',
-            nargs='+',
-            type=str,
-            metavar='[<TEST BED NAME1> <TEST BED NAME2> ...]',
-            help='Specify which test beds to run tests on.')
+                      '--test_bed',
+                      nargs='+',
+                      type=str,
+                      metavar='[<TEST BED NAME1> <TEST BED NAME2> ...]',
+                      help='Specify which test beds to run tests on.')
   if not argv:
     argv = sys.argv[1:]
   return parser.parse_known_args(argv)[0]
@@ -150,10 +148,10 @@
   """
   try:
     return utils.find_subclass_in_module(base_test.BaseTestClass,
-                       sys.modules['__main__'])
+                                         sys.modules['__main__'])
   except ValueError:
     logging.exception('Exactly one subclass of `base_test.BaseTestClass`'
-              ' should be in the main file.')
+                      ' should be in the main file.')
     sys.exit(1)
 
 
@@ -199,10 +197,10 @@
     """
 
     def __init__(self,
-           config,
-           test_class,
-           tests=None,
-           test_class_name_suffix=None):
+                 config,
+                 test_class,
+                 tests=None,
+                 test_class_name_suffix=None):
       self.config = config
       self.test_class = test_class
       self.test_class_name_suffix = test_class_name_suffix
@@ -228,9 +226,8 @@
   def _update_log_path(self):
     """Updates the logging values with the current timestamp."""
     self._start_time = logger.get_log_file_timestamp()
-    self._root_output_path = os.path.join(self._log_dir,
-                        self._testbed_name,
-                        self._start_time)
+    self._root_output_path = os.path.join(self._log_dir, self._testbed_name,
+                                          self._start_time)
 
   @contextlib.contextmanager
   def mobly_logger(self, alias='latest'):
@@ -246,8 +243,8 @@
     """
     self._update_log_path()
     logger.setup_test_logger(self._root_output_path,
-                 self._testbed_name,
-                 alias=alias)
+                             self._testbed_name,
+                             alias=alias)
     try:
       yield self._root_output_path
     finally:
@@ -272,20 +269,18 @@
         constructor.
     """
     if self._log_dir != config.log_path:
-      raise Error(
-        'TestRunner\'s log folder is "%s", but a test config with a '
-        'different log folder ("%s") was added.' %
-        (self._log_dir, config.log_path))
+      raise Error('TestRunner\'s log folder is "%s", but a test config with a '
+                  'different log folder ("%s") was added.' %
+                  (self._log_dir, config.log_path))
     if self._testbed_name != config.testbed_name:
-      raise Error(
-        'TestRunner\'s test bed is "%s", but a test config with a '
-        'different test bed ("%s") was added.' %
-        (self._testbed_name, config.testbed_name))
+      raise Error('TestRunner\'s test bed is "%s", but a test config with a '
+                  'different test bed ("%s") was added.' %
+                  (self._testbed_name, config.testbed_name))
     self._test_run_infos.append(
-      TestRunner._TestRunInfo(config=config,
-                  test_class=test_class,
-                  tests=tests,
-                  test_class_name_suffix=name_suffix))
+        TestRunner._TestRunInfo(config=config,
+                                test_class=test_class,
+                                tests=tests,
+                                test_class_name_suffix=name_suffix))
 
   def _run_test_class(self, config, test_class, tests=None):
     """Instantiates and executes a test class.
@@ -301,7 +296,7 @@
     """
     test_instance = test_class(config)
     logging.debug('Executing test class "%s" with config: %s',
-            test_class.__name__, config)
+                  test_class.__name__, config)
     try:
       cls_result = test_instance.run(tests)
       self.results += cls_result
@@ -327,7 +322,7 @@
     utils.create_dir(self._root_output_path)
 
     summary_writer = records.TestSummaryWriter(
-      os.path.join(self._root_output_path, records.OUTPUT_FILE_SUMMARY))
+        os.path.join(self._root_output_path, records.OUTPUT_FILE_SUMMARY))
     try:
       for test_run_info in self._test_run_infos:
         # Set up the test-specific config
@@ -337,17 +332,15 @@
         test_config.test_class_name_suffix = test_run_info.test_class_name_suffix
         try:
           self._run_test_class(config=test_config,
-                     test_class=test_run_info.test_class,
-                     tests=test_run_info.tests)
+                               test_class=test_run_info.test_class,
+                               tests=test_run_info.tests)
         except signals.TestAbortAll as e:
-          logging.warning(
-            'Abort all subsequent test classes. Reason: %s', e)
+          logging.warning('Abort all subsequent test classes. Reason: %s', e)
           raise
     finally:
       summary_writer.dump(self.results.summary_dict(),
-                records.TestSummaryEntryType.SUMMARY)
+                          records.TestSummaryEntryType.SUMMARY)
       # Stop and show summary.
       msg = '\nSummary for test run %s@%s: %s\n' % (
-        self._testbed_name, self._start_time,
-        self.results.summary_str())
+          self._testbed_name, self._start_time, self.results.summary_str())
       logging.info(msg.strip())
diff --git a/mobly/utils.py b/mobly/utils.py
index 55882ca..f6c2249 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -43,31 +43,31 @@
 valid_filename_chars = "-_." + ascii_letters_and_digits
 
 GMT_to_olson = {
-  "GMT-9": "America/Anchorage",
-  "GMT-8": "US/Pacific",
-  "GMT-7": "US/Mountain",
-  "GMT-6": "US/Central",
-  "GMT-5": "US/Eastern",
-  "GMT-4": "America/Barbados",
-  "GMT-3": "America/Buenos_Aires",
-  "GMT-2": "Atlantic/South_Georgia",
-  "GMT-1": "Atlantic/Azores",
-  "GMT+0": "Africa/Casablanca",
-  "GMT+1": "Europe/Amsterdam",
-  "GMT+2": "Europe/Athens",
-  "GMT+3": "Europe/Moscow",
-  "GMT+4": "Asia/Baku",
-  "GMT+5": "Asia/Oral",
-  "GMT+6": "Asia/Almaty",
-  "GMT+7": "Asia/Bangkok",
-  "GMT+8": "Asia/Hong_Kong",
-  "GMT+9": "Asia/Tokyo",
-  "GMT+10": "Pacific/Guam",
-  "GMT+11": "Pacific/Noumea",
-  "GMT+12": "Pacific/Fiji",
-  "GMT+13": "Pacific/Tongatapu",
-  "GMT-11": "Pacific/Midway",
-  "GMT-10": "Pacific/Honolulu"
+    "GMT-9": "America/Anchorage",
+    "GMT-8": "US/Pacific",
+    "GMT-7": "US/Mountain",
+    "GMT-6": "US/Central",
+    "GMT-5": "US/Eastern",
+    "GMT-4": "America/Barbados",
+    "GMT-3": "America/Buenos_Aires",
+    "GMT-2": "Atlantic/South_Georgia",
+    "GMT-1": "Atlantic/Azores",
+    "GMT+0": "Africa/Casablanca",
+    "GMT+1": "Europe/Amsterdam",
+    "GMT+2": "Europe/Athens",
+    "GMT+3": "Europe/Moscow",
+    "GMT+4": "Asia/Baku",
+    "GMT+5": "Asia/Oral",
+    "GMT+6": "Asia/Almaty",
+    "GMT+7": "Asia/Bangkok",
+    "GMT+8": "Asia/Hong_Kong",
+    "GMT+9": "Asia/Tokyo",
+    "GMT+10": "Pacific/Guam",
+    "GMT+11": "Pacific/Noumea",
+    "GMT+12": "Pacific/Fiji",
+    "GMT+13": "Pacific/Tongatapu",
+    "GMT-11": "Pacific/Midway",
+    "GMT-10": "Pacific/Honolulu"
 }
 
 
@@ -256,8 +256,7 @@
 
 
 # Thead/Process related functions.
-def concurrent_exec(func, param_list, max_workers=30,
-          raise_on_exception=False):
+def concurrent_exec(func, param_list, max_workers=30, raise_on_exception=False):
   """Executes a function with different parameters pseudo-concurrently.
 
   This is basically a map function. Each element (should be an iterable) in
@@ -294,7 +293,7 @@
         return_vals.append(future.result())
       except Exception as exc:
         logging.exception("{} generated an exception: {}".format(
-          params, traceback.format_exc()))
+            params, traceback.format_exc()))
         return_vals.append(exc)
         exceptions.append(exc)
     if raise_on_exception and exceptions:
@@ -302,26 +301,23 @@
       if sys.version_info < (3, 0):
         for exception in exceptions:
           error_messages.append(
-            unicode(exception.message,
-                encoding='utf-8',
-                errors='replace'))
+              unicode(exception.message, encoding='utf-8', errors='replace'))
       else:
         for exception in exceptions:
           error_messages.append(''.join(
-            traceback.format_exception(exception.__class__,
-                           exception,
-                           exception.__traceback__)))
+              traceback.format_exception(exception.__class__, exception,
+                                         exception.__traceback__)))
       raise RuntimeError('\n\n'.join(error_messages))
     return return_vals
 
 
 def run_command(cmd,
-        stdout=None,
-        stderr=None,
-        shell=False,
-        timeout=None,
-        cwd=None,
-        env=None):
+                stdout=None,
+                stderr=None,
+                shell=False,
+                timeout=None,
+                cwd=None,
+                env=None):
   """Runs a command in a subprocess.
 
   This function is very similar to subprocess.check_output. The main
@@ -365,11 +361,11 @@
   if stderr is None:
     stderr = subprocess.PIPE
   process = psutil.Popen(cmd,
-               stdout=stdout,
-               stderr=stderr,
-               shell=shell,
-               cwd=cwd,
-               env=env)
+                         stdout=stdout,
+                         stderr=stderr,
+                         shell=shell,
+                         cwd=cwd,
+                         env=env)
   timer = None
   timer_triggered = threading.Event()
   if timeout and timeout > 0:
@@ -414,11 +410,11 @@
   """
   logging.debug('Starting standing subprocess with: %s', cmd)
   proc = subprocess.Popen(cmd,
-              stdin=subprocess.PIPE,
-              stdout=subprocess.PIPE,
-              stderr=subprocess.PIPE,
-              shell=shell,
-              env=env)
+                          stdin=subprocess.PIPE,
+                          stdout=subprocess.PIPE,
+                          stderr=subprocess.PIPE,
+                          shell=shell,
+                          env=env)
   # Leaving stdin open causes problems for input, e.g. breaking the
   # code.inspect() shell (http://stackoverflow.com/a/25512460/1612937), so
   # explicitly close it assuming it is not needed for standing subprocesses.
@@ -464,8 +460,7 @@
       pass
     except:
       failed.append(child.pid)
-      logging.exception('Failed to kill standing subprocess %d',
-                child.pid)
+      logging.exception('Failed to kill standing subprocess %d', child.pid)
   try:
     process.kill()
     process.wait(timeout=10)
@@ -535,7 +530,7 @@
     if port not in adb.list_occupied_adb_ports():
       return port
   raise Error('Failed to find available port after {} retries'.format(
-    MAX_PORT_ALLOCATION_RETRY))
+      MAX_PORT_ALLOCATION_RETRY))
 
 
 def grep(regex, output):
@@ -626,7 +621,7 @@
   """
   subclasses = find_subclasses_in_module([base_class], module)
   if len(subclasses) != 1:
-    raise ValueError('Expected 1 subclass of %s per module, found %s.' %
-             (base_class.__name__,
-              [subclass.__name__ for subclass in subclasses]))
+    raise ValueError(
+        'Expected 1 subclass of %s per module, found %s.' %
+        (base_class.__name__, [subclass.__name__ for subclass in subclasses]))
   return subclasses[0]
diff --git a/setup.py b/setup.py
index d90bf33..591d854 100755
--- a/setup.py
+++ b/setup.py
@@ -18,8 +18,8 @@
 import sys
 
 install_requires = [
-  'future', 'portpicker', 'psutil>=5.4.4', 'pyserial', 'pyyaml',
-  'timeout_decorator'
+    'future', 'portpicker', 'psutil>=5.4.4', 'pyserial', 'pyyaml',
+    'timeout_decorator'
 ]
 
 if platform.system() == 'Windows':
@@ -44,24 +44,24 @@
 
 def main():
   setuptools.setup(
-    name='mobly',
-    version='1.10.1',
-    maintainer='Ang Li',
-    maintainer_email='mobly-github@googlegroups.com',
-    description='Automation framework for special end-to-end test cases',
-    license='Apache2.0',
-    url='https://github.com/google/mobly',
-    download_url='https://github.com/google/mobly/tarball/1.10.1',
-    packages=setuptools.find_packages(exclude=['tests']),
-    include_package_data=False,
-    scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
-    tests_require=[
-      'mock',
-      'pytest',
-      'pytz',
-    ],
-    install_requires=install_requires,
-    cmdclass={'test': PyTest},
+      name='mobly',
+      version='1.10.1',
+      maintainer='Ang Li',
+      maintainer_email='mobly-github@googlegroups.com',
+      description='Automation framework for special end-to-end test cases',
+      license='Apache2.0',
+      url='https://github.com/google/mobly',
+      download_url='https://github.com/google/mobly/tarball/1.10.1',
+      packages=setuptools.find_packages(exclude=['tests']),
+      include_package_data=False,
+      scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
+      tests_require=[
+          'mock',
+          'pytest',
+          'pytz',
+      ],
+      install_requires=install_requires,
+      cmdclass={'test': PyTest},
   )
 
 
diff --git a/tests/lib/integration_test.py b/tests/lib/integration_test.py
index bd2af1a..a3211ee 100755
--- a/tests/lib/integration_test.py
+++ b/tests/lib/integration_test.py
@@ -22,6 +22,7 @@
 
 
 class IntegrationTest(base_test.BaseTestClass):
+
   def setup_class(self):
     self.register_controller(mock_controller)
 
@@ -29,12 +30,12 @@
     asserts.assert_equal(self.user_params['icecream'], 42)
     asserts.assert_equal(self.user_params['extra_param'], 'haha')
     logging.info('This is a bare minimal test to make sure the basic MOBLY'
-           ' test flow works.')
+                 ' test flow works.')
     asserts.explicit_pass(
-      'Hello World',
-      # Use a unicode string here to make sure the full log pipeline
-      # works with unicode.
-      extras=u'\u2022')
+        'Hello World',
+        # Use a unicode string here to make sure the full log pipeline
+        # works with unicode.
+        extras=u'\u2022')
 
 
 if __name__ == '__main__':
diff --git a/tests/lib/jsonrpc_client_test_base.py b/tests/lib/jsonrpc_client_test_base.py
index 16a4d85..7623360 100755
--- a/tests/lib/jsonrpc_client_test_base.py
+++ b/tests/lib/jsonrpc_client_test_base.py
@@ -1,11 +1,11 @@
 # Copyright 2017 Google Inc.
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,25 +26,25 @@
   """
 
   MOCK_RESP = (
-    b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
-    b'"callback": null}')
+      b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
+      b'"callback": null}')
   MOCK_RESP_WITHOUT_CALLBACK = (
-    b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1}')
+      b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1}')
   MOCK_RESP_TEMPLATE = (
-    '{"id": %d, "result": 123, "error": null, "status": 1, "uid": 1, '
-    '"callback": null}')
+      '{"id": %d, "result": 123, "error": null, "status": 1, "uid": 1, '
+      '"callback": null}')
   MOCK_RESP_UNKNOWN_STATUS = (
-    b'{"id": 0, "result": 123, "error": null, "status": 0, '
-    b'"callback": null}')
+      b'{"id": 0, "result": 123, "error": null, "status": 0, '
+      b'"callback": null}')
   MOCK_RESP_WITH_CALLBACK = (
-    b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
-    b'"callback": "1-0"}')
+      b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
+      b'"callback": "1-0"}')
   MOCK_RESP_WITH_ERROR = b'{"id": 0, "error": 1, "status": 1, "uid": 1}'
   MOCK_RESP_FLEXIABLE_RESULT_LENGTH = (
-    '{"id": 0, "result": "%s", "error": null, "status": 0, "callback": null}'
-  )
+      '{"id": 0, "result": "%s", "error": null, "status": 0, "callback": null}')
 
   class MockSocketFile(object):
+
     def __init__(self, resp):
       self.resp = resp
       self.last_write = None
@@ -79,7 +79,7 @@
     # .encode('utf-8') is for py2 compatibility, after py2 deprecation, it
     # could be modified to byte('xxxxx', 'utf-8')
     return bytes((self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH % ''.join(
-      random.choice(string.ascii_lowercase)
-      for i in range(response_length -
-               len(self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH) + 2))
-            ).encode('utf-8'))
+        random.choice(string.ascii_lowercase)
+        for i in range(response_length -
+                       len(self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH) + 2))
+                 ).encode('utf-8'))
diff --git a/tests/lib/mock_android_device.py b/tests/lib/mock_android_device.py
index 2eaac66..1f0dd4c 100755
--- a/tests/lib/mock_android_device.py
+++ b/tests/lib/mock_android_device.py
@@ -22,16 +22,16 @@
 import os
 
 DEFAULT_MOCK_PROPERTIES = {
-  'ro.build.id': 'AB42',
-  'ro.build.type': 'userdebug',
-  'ro.build.product': 'FakeModel',
-  'ro.build.version.codename': 'Z',
-  'ro.build.version.sdk': '28',
-  'ro.product.name': 'FakeModel',
-  'ro.debuggable': '1',
-  'sys.boot_completed': "1",
-  'ro.build.characteristics': 'emulator,phone',
-  'ro.hardware': 'marlin',
+    'ro.build.id': 'AB42',
+    'ro.build.type': 'userdebug',
+    'ro.build.product': 'FakeModel',
+    'ro.build.version.codename': 'Z',
+    'ro.build.version.sdk': '28',
+    'ro.product.name': 'FakeModel',
+    'ro.debuggable': '1',
+    'sys.boot_completed': "1",
+    'ro.build.characteristics': 'emulator,phone',
+    'ro.hardware': 'marlin',
 }
 
 
@@ -80,12 +80,12 @@
   """Mock class that swaps out calls to adb with mock calls."""
 
   def __init__(self,
-         serial='',
-         fail_br=False,
-         fail_br_before_N=False,
-         mock_properties=None,
-         installed_packages=None,
-         instrumented_packages=None):
+               serial='',
+               fail_br=False,
+               fail_br_before_N=False,
+               mock_properties=None,
+               installed_packages=None,
+               instrumented_packages=None):
     self.serial = serial
     self.fail_br = fail_br
     self.fail_br_before_N = fail_br_before_N
@@ -115,18 +115,16 @@
       return b'1.1'
     elif 'pm list package' in params:
       packages = self.installed_packages + [
-        package for package, _, _ in self.instrumented_packages
+          package for package, _, _ in self.instrumented_packages
       ]
-      return bytes(
-        '\n'.join(['package:%s' % package for package in packages]),
-        'utf-8')
+      return bytes('\n'.join(['package:%s' % package for package in packages]),
+                   'utf-8')
     elif 'pm list instrumentation' in params:
       return bytes(
-        '\n'.join([
-          'instrumentation:%s/%s (target=%s)' %
-          (package, runner, target)
-          for package, runner, target in self.instrumented_packages
-        ]), 'utf-8')
+          '\n'.join([
+              'instrumentation:%s/%s (target=%s)' % (package, runner, target)
+              for package, runner, target in self.instrumented_packages
+          ]), 'utf-8')
     elif 'which' in params:
       return b''
 
@@ -140,8 +138,8 @@
 
   def bugreport(self, args, shell=False, timeout=None):
     expected = os.path.join(
-      logging.log_path, 'AndroidDevice%s' % self.serial, 'BugReports',
-      'bugreport,test_something,%s,fakemodel,sometime' % self.serial)
+        logging.log_path, 'AndroidDevice%s' % self.serial, 'BugReports',
+        'bugreport,test_something,%s,fakemodel,sometime' % self.serial)
     if expected not in args:
       raise Error('"Expected "%s", got "%s"' % (expected, args))
 
@@ -167,6 +165,7 @@
     return b"xxxx device\nyyyy device"
 
   def __getattr__(self, name):
+
     def fastboot_call(*args):
       arg_str = ' '.join(str(elem) for elem in args)
       return arg_str
diff --git a/tests/lib/mock_controller.py b/tests/lib/mock_controller.py
index b6df7c0..bfad027 100644
--- a/tests/lib/mock_controller.py
+++ b/tests/lib/mock_controller.py
@@ -1,11 +1,11 @@
 # Copyright 2016 Google Inc.
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,6 +40,7 @@
 
 
 class MagicDevice(object):
+
   def __init__(self, config):
     self.magic = config
 
diff --git a/tests/lib/mock_instrumentation_test.py b/tests/lib/mock_instrumentation_test.py
index 08f33e1..28313f4 100644
--- a/tests/lib/mock_instrumentation_test.py
+++ b/tests/lib/mock_instrumentation_test.py
@@ -25,6 +25,7 @@
 
 class MockInstrumentationTest(
     base_instrumentation_test.BaseInstrumentationTestClass):
+
   def __init__(self, tmp_dir, user_params={}):
     mock_test_run_configs = config_parser.TestRunConfig()
     mock_test_run_configs.summary_writer = mock.Mock()
@@ -34,6 +35,7 @@
     super(MockInstrumentationTest, self).__init__(mock_test_run_configs)
 
   def run_mock_instrumentation_test(self, instrumentation_output, prefix):
+
     def fake_instrument(package, options=None, runner=None, handler=None):
       for line in instrumentation_output.splitlines():
         handler(line)
@@ -42,5 +44,6 @@
     mock_device = mock.Mock(spec=android_device.AndroidDevice)
     mock_device.adb = mock.Mock(spec=adb.AdbProxy)
     mock_device.adb.instrument = fake_instrument
-    return self.run_instrumentation_test(
-      mock_device, MOCK_TEST_PACKAGE, prefix=prefix)
+    return self.run_instrumentation_test(mock_device,
+                                         MOCK_TEST_PACKAGE,
+                                         prefix=prefix)
diff --git a/tests/lib/mock_second_controller.py b/tests/lib/mock_second_controller.py
index 908b53d..d39e973 100644
--- a/tests/lib/mock_second_controller.py
+++ b/tests/lib/mock_second_controller.py
@@ -1,11 +1,11 @@
 # Copyright 2016 Google Inc.
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,6 +45,7 @@
 
   It is used for testing that this info is correctly recorded by Mobly.
   """
+
   def __init__(self, config):
     self.magic = config
 
diff --git a/tests/lib/multiple_subclasses_module.py b/tests/lib/multiple_subclasses_module.py
index e78beb7..84f79f3 100755
--- a/tests/lib/multiple_subclasses_module.py
+++ b/tests/lib/multiple_subclasses_module.py
@@ -15,17 +15,22 @@
 from mobly import base_test
 from mobly import test_runner
 
+
 class Subclass1Test(base_test.BaseTestClass):
   pass
 
+
 class Subclass2Test(base_test.BaseTestClass):
   pass
 
+
 class Subclass1Runner(test_runner.TestRunner):
   pass
 
+
 class Subclass2Runner(test_runner.TestRunner):
   pass
 
+
 class UnrelatedClass(object):
   pass
diff --git a/tests/lib/teardown_class_failure_test.py b/tests/lib/teardown_class_failure_test.py
index 596476b..bfb6635 100755
--- a/tests/lib/teardown_class_failure_test.py
+++ b/tests/lib/teardown_class_failure_test.py
@@ -17,6 +17,7 @@
 
 
 class TearDownClassFailureTest(base_test.BaseTestClass):
+
   def test_foo(self):
     pass
 
diff --git a/tests/lib/utils.py b/tests/lib/utils.py
index 8f1da4a..f70fad1 100644
--- a/tests/lib/utils.py
+++ b/tests/lib/utils.py
@@ -27,13 +27,13 @@
     result: The `records.TestResult` object to validate.
   """
   buckets = [
-    (result.passed, records.TestResultEnums.TEST_RESULT_PASS),
-    (result.failed, records.TestResultEnums.TEST_RESULT_FAIL),
-    (result.error, records.TestResultEnums.TEST_RESULT_ERROR),
-    (result.skipped, records.TestResultEnums.TEST_RESULT_SKIP),
+      (result.passed, records.TestResultEnums.TEST_RESULT_PASS),
+      (result.failed, records.TestResultEnums.TEST_RESULT_FAIL),
+      (result.error, records.TestResultEnums.TEST_RESULT_ERROR),
+      (result.skipped, records.TestResultEnums.TEST_RESULT_SKIP),
   ]
   for bucket_list, expected_enum in buckets:
     for record in bucket_list:
       if record.result != expected_enum:
         raise AssertionError('Expected result %s, got %s.' %
-                   (expected_enum, record.result))
+                             (expected_enum, record.result))
diff --git a/tests/mobly/asserts_test.py b/tests/mobly/asserts_test.py
index 547f4a9..6df0bb6 100755
--- a/tests/mobly/asserts_test.py
+++ b/tests/mobly/asserts_test.py
@@ -23,10 +23,10 @@
 class AssertsTest(unittest.TestCase):
   """Verifies that asserts.xxx functions raise the correct test signals.
   """
+
   def test_assert_false(self):
     asserts.assert_false(False, MSG_EXPECTED_EXCEPTION)
-    with self.assertRaisesRegex(signals.TestFailure,
-                   MSG_EXPECTED_EXCEPTION):
+    with self.assertRaisesRegex(signals.TestFailure, MSG_EXPECTED_EXCEPTION):
       asserts.assert_false(True, MSG_EXPECTED_EXCEPTION)
 
 
diff --git a/tests/mobly/base_instrumentation_test_test.py b/tests/mobly/base_instrumentation_test_test.py
index ea6d2e4..edbd73b 100755
--- a/tests/mobly/base_instrumentation_test_test.py
+++ b/tests/mobly/base_instrumentation_test_test.py
@@ -48,6 +48,7 @@
 
 
 class InstrumentationResult(object):
+
   def __init__(self):
     self.error = None
     self.completed_and_passed = False
@@ -56,6 +57,7 @@
 
 
 class BaseInstrumentationTestTest(unittest.TestCase):
+
   def setUp(self):
     self.tmp_dir = tempfile.mkdtemp()
 
@@ -63,48 +65,48 @@
     shutil.rmtree(self.tmp_dir)
 
   def assert_parse_instrumentation_options(self, user_params,
-                       expected_instrumentation_options):
+                                           expected_instrumentation_options):
     mit = mock_instrumentation_test.MockInstrumentationTest(
-      self.tmp_dir, user_params)
-    instrumentation_options = mit.parse_instrumentation_options(
-      mit.user_params)
-    self.assertEqual(instrumentation_options,
-             expected_instrumentation_options)
+        self.tmp_dir, user_params)
+    instrumentation_options = mit.parse_instrumentation_options(mit.user_params)
+    self.assertEqual(instrumentation_options, expected_instrumentation_options)
 
   def test_parse_instrumentation_options_with_no_user_params(self):
     self.assert_parse_instrumentation_options({}, {})
 
-  def test_parse_instrumentation_options_with_no_instrumentation_params(
-      self):
+  def test_parse_instrumentation_options_with_no_instrumentation_params(self):
     self.assert_parse_instrumentation_options(
-      {
-        'param1': 'val1',
-        'param2': 'val2',
-      },
-      {},
+        {
+            'param1': 'val1',
+            'param2': 'val2',
+        },
+        {},
     )
 
-  def test_parse_instrumentation_options_with_only_instrumentation_params(
-      self):
+  def test_parse_instrumentation_options_with_only_instrumentation_params(self):
     self.assert_parse_instrumentation_options(
-      {
-        'instrumentation_option_key1': 'value1',
-        'instrumentation_option_key2': 'value2',
-      },
-      {'key1': 'value1',
-       'key2': 'value2'},
+        {
+            'instrumentation_option_key1': 'value1',
+            'instrumentation_option_key2': 'value2',
+        },
+        {
+            'key1': 'value1',
+            'key2': 'value2'
+        },
     )
 
   def test_parse_instrumentation_options_with_mixed_user_params(self):
     self.assert_parse_instrumentation_options(
-      {
-        'param1': 'val1',
-        'param2': 'val2',
-        'instrumentation_option_key1': 'value1',
-        'instrumentation_option_key2': 'value2',
-      },
-      {'key1': 'value1',
-       'key2': 'value2'},
+        {
+            'param1': 'val1',
+            'param2': 'val2',
+            'instrumentation_option_key1': 'value1',
+            'instrumentation_option_key2': 'value2',
+        },
+        {
+            'key1': 'value1',
+            'key2': 'value2'
+        },
     )
 
   def run_instrumentation_test(self, instrumentation_output, prefix=None):
@@ -112,7 +114,7 @@
     result = InstrumentationResult()
     try:
       result.completed_and_passed = mit.run_mock_instrumentation_test(
-        instrumentation_output, prefix=prefix)
+          instrumentation_output, prefix=prefix)
     except signals.TestError as e:
       result.error = e
     result.executed = mit.results.executed
@@ -122,10 +124,10 @@
   def assert_equal_test(self, actual_test, expected_test):
     (expected_test_name, expected_signal) = expected_test
     self.assertEqual(actual_test.test_class,
-             MOCK_INSTRUMENTATION_TEST_CLASS_NAME)
+                     MOCK_INSTRUMENTATION_TEST_CLASS_NAME)
     self.assertEqual(actual_test.test_name, expected_test_name)
     self.assertIsInstance(actual_test.termination_signal.exception,
-                expected_signal)
+                          expected_signal)
 
   def convert_to_raw_output(self, test_output):
     """Converts code-based strings into adb output strings.
@@ -140,32 +142,30 @@
       return bytes(test_output)
 
   def assert_run_instrumentation_test(self,
-                    instrumentation_output,
-                    expected_executed=[],
-                    expected_skipped=[],
-                    expected_completed_and_passed=False,
-                    expected_has_error=False,
-                    prefix=None,
-                    expected_executed_times=[]):
+                                      instrumentation_output,
+                                      expected_executed=[],
+                                      expected_skipped=[],
+                                      expected_completed_and_passed=False,
+                                      expected_has_error=False,
+                                      prefix=None,
+                                      expected_executed_times=[]):
     result = self.run_instrumentation_test(
-      self.convert_to_raw_output(instrumentation_output), prefix=prefix)
+        self.convert_to_raw_output(instrumentation_output), prefix=prefix)
     if expected_has_error:
       self.assertIsInstance(result.error, signals.TestError)
     else:
       self.assertIsNone(result.error)
       self.assertEqual(result.completed_and_passed,
-               expected_completed_and_passed)
+                       expected_completed_and_passed)
     self.assertEqual(len(result.executed), len(expected_executed))
-    for actual_test, expected_test in zip(result.executed,
-                        expected_executed):
+    for actual_test, expected_test in zip(result.executed, expected_executed):
       self.assert_equal_test(actual_test, expected_test)
     self.assertEqual(len(result.skipped), len(expected_skipped))
-    for actual_test, expected_test in zip(result.skipped,
-                        expected_skipped):
+    for actual_test, expected_test in zip(result.skipped, expected_skipped):
       self.assert_equal_test(actual_test, expected_test)
     if expected_executed_times:
       for actual_test, expected_time in zip(result.executed,
-                          expected_executed_times):
+                                            expected_executed_times):
         (expected_begin_time, expected_end_time) = expected_time
         self.assertEqual(actual_test.begin_time, expected_begin_time)
         self.assertEqual(actual_test.end_time, expected_end_time)
@@ -191,14 +191,14 @@
 
 Error: Bad component name: /
 """
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_has_error=True)
 
   def test_run_instrumentation_test_with_no_output(self):
     instrumentation_output = """\
 """
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_has_error=True)
 
   def test_run_instrumentation_test_with_missing_test_package(self):
     instrumentation_output = """\
@@ -212,8 +212,8 @@
 INSTRUMENTATION_STATUS: id=ActivityManagerService
 INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.my.package.test/com.my.package.test.runner.MyRunner}
 INSTRUMENTATION_STATUS_CODE: -1"""
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_has_error=True)
 
   def test_run_instrumentation_test_with_missing_runner(self):
     instrumentation_output = """\
@@ -227,22 +227,22 @@
   at com.android.commands.am.Am.main(Am.java:124)
   at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
   at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)"""
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_has_error=True)
 
   def test_run_instrumentation_test_with_no_tests(self):
     instrumentation_output = MOCK_EMPTY_INSTRUMENTATION_TEST
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_completed_and_passed=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_completed_and_passed=True)
 
   @unittest.skipUnless(
-    sys.version_info >= (3, 0),
-    'Only python3 displays different string types differently.')
+      sys.version_info >= (3, 0),
+      'Only python3 displays different string types differently.')
   @mock.patch('logging.info')
   def test_run_instrumentation_test_logs_correctly(self, mock_info_logger):
     instrumentation_output = MOCK_EMPTY_INSTRUMENTATION_TEST
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_completed_and_passed=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_completed_and_passed=True)
     for mock_call in mock_info_logger.mock_calls:
       logged_format = mock_call[1][0]
       self.assertIsInstance(logged_format, str)
@@ -275,14 +275,13 @@
 INSTRUMENTATION_CODE: -1
 """
     expected_executed = [
-      ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
+        ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
     ]
     mock_get_time.side_effect = [13, 51]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_completed_and_passed=True,
-      expected_executed_times=[(13, 51)])
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_completed_and_passed=True,
+                                         expected_executed_times=[(13, 51)])
 
   def test_run_instrumentation_test_with_random_whitespace(self):
     instrumentation_output = """\
@@ -332,12 +331,11 @@
 
 """
     expected_executed = [
-      ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
+        ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_completed_and_passed=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_completed_and_passed=True)
 
   def test_run_instrumentation_test_with_prefix_test(self):
     instrumentation_output = """\
@@ -366,14 +364,13 @@
 INSTRUMENTATION_CODE: -1
 """
     expected_executed = [
-      ('%s.com.my.package.test.BasicTest#basicTest' % MOCK_PREFIX,
-       signals.TestPass),
+        ('%s.com.my.package.test.BasicTest#basicTest' % MOCK_PREFIX,
+         signals.TestPass),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_completed_and_passed=True,
-      prefix=MOCK_PREFIX)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_completed_and_passed=True,
+                                         prefix=MOCK_PREFIX)
 
   def test_run_instrumentation_test_with_failing_test(self):
     instrumentation_output = """\
@@ -557,10 +554,10 @@
 
 INSTRUMENTATION_CODE: -1"""
     expected_executed = [
-      ('com.my.package.test.BasicTest#failingTest', signals.TestFailure),
+        ('com.my.package.test.BasicTest#failingTest', signals.TestFailure),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_executed=expected_executed)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed)
 
   def test_run_instrumentation_test_with_assumption_failure_test(self):
     instrumentation_output = """\
@@ -642,13 +639,12 @@
 
 INSTRUMENTATION_CODE: -1"""
     expected_skipped = [
-      ('com.my.package.test.BasicTest#assumptionFailureTest',
-       signals.TestSkip),
+        ('com.my.package.test.BasicTest#assumptionFailureTest',
+         signals.TestSkip),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_skipped=expected_skipped,
-      expected_completed_and_passed=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_skipped=expected_skipped,
+                                         expected_completed_and_passed=True)
 
   def test_run_instrumentation_test_with_ignored_test(self):
     instrumentation_output = """\
@@ -677,12 +673,11 @@
 
 INSTRUMENTATION_CODE: -1"""
     expected_skipped = [
-      ('com.my.package.test.BasicTest#ignoredTest', signals.TestSkip),
+        ('com.my.package.test.BasicTest#ignoredTest', signals.TestSkip),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_skipped=expected_skipped,
-      expected_completed_and_passed=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_skipped=expected_skipped,
+                                         expected_completed_and_passed=True)
 
   @mock.patch('mobly.utils.get_current_epoch_time')
   def test_run_instrumentation_test_with_crashed_test(self, mock_get_time):
@@ -698,14 +693,13 @@
 INSTRUMENTATION_RESULT: shortMsg=Process crashed.
 INSTRUMENTATION_CODE: 0"""
     expected_executed = [
-      ('com.my.package.test.BasicTest#crashTest', signals.TestError),
+        ('com.my.package.test.BasicTest#crashTest', signals.TestError),
     ]
     mock_get_time.side_effect = [67, 942]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_has_error=True,
-      expected_executed_times=[(67, 942)])
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_has_error=True,
+                                         expected_executed_times=[(67, 942)])
 
   @mock.patch('mobly.utils.get_current_epoch_time')
   def test_run_instrumentation_test_with_crashing_test(self, mock_get_time):
@@ -735,25 +729,25 @@
 
 INSTRUMENTATION_CODE: -1"""
     expected_executed = [
-      ('com.my.package.test.BasicTest#crashAndRecover1Test',
-       signals.TestError),
-      ('com.my.package.test.BasicTest#crashAndRecover2Test',
-       signals.TestError),
+        ('com.my.package.test.BasicTest#crashAndRecover1Test',
+         signals.TestError),
+        ('com.my.package.test.BasicTest#crashAndRecover2Test',
+         signals.TestError),
     ]
     mock_get_time.side_effect = [16, 412, 4143, 6547]
     # TODO(winterfrosts): Fix this issue with overlapping timing
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_completed_and_passed=True,
-      expected_executed_times=[(16, 4143), (412, 6547)])
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_completed_and_passed=True,
+                                         expected_executed_times=[(16, 4143),
+                                                                  (412, 6547)])
 
   def test_run_instrumentation_test_with_runner_setup_crash(self):
     instrumentation_output = """\
 INSTRUMENTATION_RESULT: shortMsg=Process crashed.
 INSTRUMENTATION_CODE: 0"""
-    self.assert_run_instrumentation_test(
-      instrumentation_output, expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_has_error=True)
 
   def test_run_instrumentation_test_with_runner_teardown_crash(self):
     instrumentation_output = """\
@@ -776,12 +770,11 @@
 INSTRUMENTATION_CODE: 0
 """
     expected_executed = [
-      ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
+        ('com.my.package.test.BasicTest#basicTest', signals.TestPass),
     ]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_has_error=True)
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_has_error=True)
 
   @mock.patch('mobly.utils.get_current_epoch_time')
   def test_run_instrumentation_test_with_multiple_tests(self, mock_get_time):
@@ -1060,20 +1053,20 @@
 
 INSTRUMENTATION_CODE: -1"""
     expected_executed = [
-      ('com.my.package.test.BasicTest#failingTest', signals.TestFailure),
-      ('com.my.package.test.BasicTest#passingTest', signals.TestPass),
+        ('com.my.package.test.BasicTest#failingTest', signals.TestFailure),
+        ('com.my.package.test.BasicTest#passingTest', signals.TestPass),
     ]
     expected_skipped = [
-      ('com.my.package.test.BasicTest#assumptionFailureTest',
-       signals.TestSkip),
-      ('com.my.package.test.BasicTest#ignoredTest', signals.TestSkip),
+        ('com.my.package.test.BasicTest#assumptionFailureTest',
+         signals.TestSkip),
+        ('com.my.package.test.BasicTest#ignoredTest', signals.TestSkip),
     ]
     mock_get_time.side_effect = [54, 64, -1, -1, -1, -1, 89, 94]
-    self.assert_run_instrumentation_test(
-      instrumentation_output,
-      expected_executed=expected_executed,
-      expected_skipped=expected_skipped,
-      expected_executed_times=[(54, 64), (89, 94)])
+    self.assert_run_instrumentation_test(instrumentation_output,
+                                         expected_executed=expected_executed,
+                                         expected_skipped=expected_skipped,
+                                         expected_executed_times=[(54, 64),
+                                                                  (89, 94)])
 
   def test__Instrumentation_block_set_key_on_multiple_equals_sign(self):
     value = "blah=blah, blah2=blah2, blah=2=1=2"
@@ -1081,7 +1074,7 @@
     block = _InstrumentationBlock()
     block.set_key(_InstrumentationStructurePrefixes.STATUS, parsed_line)
     self.assertIn(value,
-            block.known_keys[_InstrumentationKnownStatusKeys.STACK])
+                  block.known_keys[_InstrumentationKnownStatusKeys.STACK])
 
 
 if __name__ == '__main__':
diff --git a/tests/mobly/base_test_test.py b/tests/mobly/base_test_test.py
index 4946d1a..36e28a0 100755
--- a/tests/mobly/base_test_test.py
+++ b/tests/mobly/base_test_test.py
@@ -50,12 +50,13 @@
 
 
 class BaseTestTest(unittest.TestCase):
+
   def setUp(self):
     self.tmp_dir = tempfile.mkdtemp()
     self.mock_test_cls_configs = config_parser.TestRunConfig()
     self.summary_file = os.path.join(self.tmp_dir, 'summary.yaml')
     self.mock_test_cls_configs.summary_writer = records.TestSummaryWriter(
-      self.summary_file)
+        self.summary_file)
     self.mock_test_cls_configs.controller_configs = {}
     self.mock_test_cls_configs.log_path = self.tmp_dir
     self.mock_test_cls_configs.user_params = {"some_param": "hahaha"}
@@ -70,6 +71,7 @@
     path_checker = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         path_checker.log_path = self.log_path
         path_checker.root_output_path = self.root_output_path
@@ -83,12 +85,14 @@
     self.assertTrue(os.path.exists(path_checker.log_path))
 
   def test_current_test_name(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.assert_true(self.current_test_info.name == "test_func",
-                  ("Got "
-                   "unexpected test name %s.") %
-                  self.current_test_info.name)
+                            ("Got "
+                             "unexpected test name %s.") %
+                            self.current_test_info.name)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run(test_names=["test_func"])
@@ -98,15 +102,16 @@
     self.assertIsNone(actual_record.extras)
 
   def test_current_test_info(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.assert_true(
-          self.current_test_info.name == 'test_func',
-          'Got unexpected test name %s.' %
-          self.current_test_info.name)
+            self.current_test_info.name == 'test_func',
+            'Got unexpected test name %s.' % self.current_test_info.name)
         output_path = self.current_test_info.output_path
         asserts.assert_true(os.path.exists(output_path),
-                  'test output path missing')
+                            'test output path missing')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run(test_names=['test_func'])
@@ -116,15 +121,16 @@
     self.assertIsNone(actual_record.extras)
 
   def test_current_test_info_in_setup_class(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         asserts.assert_true(
-          self.current_test_info.name == 'setup_class',
-          'Got unexpected test name %s.' %
-          self.current_test_info.name)
+            self.current_test_info.name == 'setup_class',
+            'Got unexpected test name %s.' % self.current_test_info.name)
         output_path = self.current_test_info.output_path
         asserts.assert_true(os.path.exists(output_path),
-                  'test output path missing')
+                            'test output path missing')
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -135,10 +141,12 @@
     self.assertIsNone(actual_record.extras)
 
   def test_self_tests_list(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def __init__(self, controllers):
         super(MockBaseTest, self).__init__(controllers)
-        self.tests = ("test_something", )
+        self.tests = ("test_something",)
 
       def test_something(self):
         pass
@@ -153,10 +161,12 @@
     self.assertEqual(actual_record.test_name, "test_something")
 
   def test_self_tests_list_fail_by_convention(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def __init__(self, controllers):
         super(MockBaseTest, self).__init__(controllers)
-        self.tests = ("not_a_test_something", )
+        self.tests = ("not_a_test_something",)
 
       def not_a_test_something(self):
         pass
@@ -166,17 +176,18 @@
         never_call()
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
-    expected_msg = (
-      r'Test method name not_a_test_something does not follow '
-      r'naming convention test_\*, abort.')
+    expected_msg = (r'Test method name not_a_test_something does not follow '
+                    r'naming convention test_\*, abort.')
     with self.assertRaisesRegex(base_test.Error, expected_msg):
       bt_cls.run()
 
   def test_cli_test_selection_override_self_tests_list(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def __init__(self, controllers):
         super(MockBaseTest, self).__init__(controllers)
-        self.tests = ("test_never", )
+        self.tests = ("test_never",)
 
       def test_something(self):
         pass
@@ -191,10 +202,12 @@
     self.assertEqual(actual_record.test_name, "test_something")
 
   def test_cli_test_selection_fail_by_convention(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def __init__(self, controllers):
         super(MockBaseTest, self).__init__(controllers)
-        self.tests = ("not_a_test_something", )
+        self.tests = ("not_a_test_something",)
 
       def not_a_test_something(self):
         pass
@@ -204,14 +217,15 @@
         never_call()
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
-    expected_msg = (
-      r'Test method name not_a_test_something does not follow '
-      r'naming convention test_\*, abort.')
+    expected_msg = (r'Test method name not_a_test_something does not follow '
+                    r'naming convention test_\*, abort.')
     with self.assertRaisesRegex(base_test.Error, expected_msg):
       bt_cls.run(test_names=["not_a_test_something"])
 
   def test_default_execution_of_all_tests(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_something(self):
         pass
 
@@ -230,6 +244,7 @@
     mock_undecorated = mock.MagicMock()
 
     class TestDecorator(object):
+
       def __init__(self, func):
         self.func = func
 
@@ -240,6 +255,7 @@
         return functools.partial(self.__call__, instance)
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def __init__(self, controllers):
         super(MockBaseTest, self).__init__(controllers)
         self.test_noncallable = None
@@ -254,11 +270,12 @@
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run()
     self.assertNotIn('test_noncallable',
-             [test.test_name for test in bt_cls.results.executed])
+                     [test.test_name for test in bt_cls.results.executed])
     mock_decorated.assert_called_once_with('test_decorated')
     mock_undecorated.assert_called_once_with('test_undecorated')
 
   def test_missing_requested_test_func(self):
+
     class MockBaseTest(base_test.BaseTestClass):
       pass
 
@@ -273,6 +290,7 @@
     on_fail_call_check = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -304,7 +322,7 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 0, Failed 0, Passed 0, "
-              "Requested 2, Skipped 2")
+                        "Requested 2, Skipped 2")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
     teardown_class_call_check.assert_called_once_with("heehee")
     on_fail_call_check.assert_called_once_with("haha")
@@ -315,10 +333,11 @@
     mock_ctrlr_2_config_name = mock_second_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{'serial': 'xxxx', 'magic': 'Magic'}]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
-    mock_test_config.controller_configs[
-      mock_ctrlr_2_config_name] = copy.copy(my_config)
+    mock_test_config.controller_configs[mock_ctrlr_2_config_name] = copy.copy(
+        my_config)
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         self.register_controller(mock_controller)
 
@@ -339,17 +358,13 @@
     self.assertIsNotNone(class_record.end_time)
     self.assertIsNone(class_record.extras)
     expected_summary = ('Error 1, Executed 1, Failed 0, Passed 1, '
-              'Requested 1, Skipped 0')
+                        'Requested 1, Skipped 0')
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
     # Verify the controller info is recorded correctly.
     info = bt_cls.results.controller_info[0]
     self.assertEqual(info.test_class, 'MockBaseTest')
     self.assertEqual(info.controller_name, 'MagicDevice')
-    self.assertEqual(info.controller_info, [{
-      'MyMagic': {
-        'magic': 'Magic'
-      }
-    }])
+    self.assertEqual(info.controller_info, [{'MyMagic': {'magic': 'Magic'}}])
 
   def test_teardown_class_raise_abort_all(self):
     mock_test_config = self.mock_test_cls_configs.copy()
@@ -357,10 +372,11 @@
     mock_ctrlr_2_config_name = mock_second_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{'serial': 'xxxx', 'magic': 'Magic'}]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
-    mock_test_config.controller_configs[
-      mock_ctrlr_2_config_name] = copy.copy(my_config)
+    mock_test_config.controller_configs[mock_ctrlr_2_config_name] = copy.copy(
+        my_config)
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         self.register_controller(mock_controller)
 
@@ -371,28 +387,24 @@
         raise asserts.abort_all(MSG_EXPECTED_EXCEPTION)
 
     bt_cls = MockBaseTest(mock_test_config)
-    with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION):
+    with self.assertRaisesRegex(signals.TestAbortAll, MSG_EXPECTED_EXCEPTION):
       bt_cls.run()
     test_record = bt_cls.results.passed[0]
     self.assertTrue(bt_cls.results.is_all_pass)
     expected_summary = ('Error 0, Executed 1, Failed 0, Passed 1, '
-              'Requested 1, Skipped 0')
+                        'Requested 1, Skipped 0')
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
     # Verify the controller info is recorded correctly.
     info = bt_cls.results.controller_info[0]
     self.assertEqual(info.test_class, 'MockBaseTest')
     self.assertEqual(info.controller_name, 'MagicDevice')
-    self.assertEqual(info.controller_info, [{
-      'MyMagic': {
-        'magic': 'Magic'
-      }
-    }])
+    self.assertEqual(info.controller_info, [{'MyMagic': {'magic': 'Magic'}}])
 
   def test_setup_test_fail_by_exception(self):
     mock_on_fail = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, *args):
         mock_on_fail('on_fail')
 
@@ -410,16 +422,18 @@
     self.assertEqual(actual_record.test_name, self.mock_test_name)
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertTrue('in setup_test\n    '
-            'raise Exception(MSG_EXPECTED_EXCEPTION)\n'
-            'Exception: This is an expected exception.\n' in
-            actual_record.stacktrace)
+                    'raise Exception(MSG_EXPECTED_EXCEPTION)\n'
+                    'Exception: This is an expected exception.\n' in
+                    actual_record.stacktrace)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_setup_test_fail_by_test_signal(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         raise signals.TestFailure(MSG_EXPECTED_EXCEPTION)
 
@@ -437,11 +451,13 @@
     self.assertIsNone(actual_record.extras)
     self.assertTrue(actual_record.end_time)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_teardown_test_assert_fail(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         asserts.fail(MSG_EXPECTED_EXCEPTION)
 
@@ -456,11 +472,13 @@
     self.assertTrue(actual_record.end_time)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_teardown_test_raise_exception(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -475,13 +493,14 @@
     self.assertIsNone(actual_record.extras)
     self.assertFalse(actual_record.extra_errors)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_teardown_test_executed_if_test_pass(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         my_mock("teardown_test")
 
@@ -497,13 +516,14 @@
     self.assertIsNone(actual_record.extras)
     self.assertTrue(actual_record.end_time)
     expected_summary = ("Error 0, Executed 1, Failed 0, Passed 1, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_teardown_test_executed_if_setup_test_fails(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -522,13 +542,14 @@
     self.assertIsNone(actual_record.extras)
     self.assertTrue(actual_record.end_time)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_teardown_test_executed_if_test_fails(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         my_mock("teardown_test")
 
@@ -546,13 +567,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_executed_if_teardown_test_fails(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         my_mock("on_fail")
 
@@ -573,13 +595,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_executed_if_test_fails(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         assert self.current_test_info.name == 'test_something'
         my_mock("on_fail")
@@ -598,13 +621,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_procedure_function_gets_correct_record(self):
     on_fail_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         on_fail_mock.record = record
 
@@ -615,21 +639,20 @@
     bt_cls.run()
     actual_record = bt_cls.results.failed[0]
     self.assertEqual(actual_record.test_name, 'test_something')
-    self.assertEqual(on_fail_mock.record.test_name,
-             actual_record.test_name)
-    self.assertEqual(on_fail_mock.record.begin_time,
-             actual_record.begin_time)
+    self.assertEqual(on_fail_mock.record.test_name, actual_record.test_name)
+    self.assertEqual(on_fail_mock.record.begin_time, actual_record.begin_time)
     self.assertEqual(on_fail_mock.record.end_time, actual_record.end_time)
-    self.assertEqual(on_fail_mock.record.stacktrace,
-             actual_record.stacktrace)
+    self.assertEqual(on_fail_mock.record.stacktrace, actual_record.stacktrace)
     self.assertEqual(on_fail_mock.record.extras, actual_record.extras)
     self.assertEqual(on_fail_mock.record.extra_errors,
-             actual_record.extra_errors)
+                     actual_record.extra_errors)
     # But they are not the same object.
     self.assertIsNot(on_fail_mock.record, actual_record)
 
   def test_on_fail_cannot_modify_original_record(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         record.test_name = 'blah'
 
@@ -645,6 +668,7 @@
     on_fail_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         on_fail_mock("on_fail")
 
@@ -664,16 +688,17 @@
     self.assertEqual(actual_record.test_name, self.mock_test_name)
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(actual_record.extra_errors['teardown_test'].details,
-             'This is an expected exception.ha')
+                     'This is an expected exception.ha')
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_executed_if_setup_test_fails_by_exception(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -691,13 +716,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_executed_if_setup_class_fails_by_exception(self):
     my_mock = mock.MagicMock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -715,13 +741,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 0, Failed 0, Passed 0, "
-              "Requested 1, Skipped 1")
+                        "Requested 1, Skipped 1")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_triggered_by_setup_class_failure_then_fail_too(self):
     """Errors thrown from on_fail should be captured."""
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -737,13 +764,15 @@
     self.assertEqual(setup_class_record.test_name, 'setup_class')
     self.assertEqual(setup_class_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(setup_class_record.extra_errors['on_fail'].details,
-             'Failure in on_fail.')
+                     'Failure in on_fail.')
     expected_summary = ("Error 1, Executed 0, Failed 0, Passed 0, "
-              "Requested 1, Skipped 1")
+                        "Requested 1, Skipped 1")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_failure_to_call_procedure_function_is_recorded(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self):
         pass
 
@@ -758,13 +787,14 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_failure_in_procedure_functions_is_recorded(self):
     expected_msg = "Something failed in on_pass."
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_pass(self, record):
         raise Exception(expected_msg)
 
@@ -775,16 +805,18 @@
     bt_cls.run()
     actual_record = bt_cls.results.error[0]
     self.assertEqual(actual_record.extra_errors['on_pass'].details,
-             expected_msg)
+                     expected_msg)
     self.assertEqual(actual_record.test_name, self.mock_test_name)
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_both_teardown_and_test_body_raise_exceptions(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         asserts.assert_true(False, MSG_EXPECTED_EXCEPTION)
 
@@ -798,10 +830,10 @@
     self.assertEqual(actual_record.details, "Test Body Exception.")
     self.assertIsNone(actual_record.extras)
     self.assertEqual(actual_record.extra_errors['teardown_test'].details,
-             MSG_EXPECTED_EXCEPTION)
+                     MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extra_errors['teardown_test'].extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_exception_objects_in_record(self):
@@ -811,6 +843,7 @@
     expected_extra_error = Exception('teardown_test Exception.')
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         raise expected_extra_error
 
@@ -821,7 +854,7 @@
     bt_cls.run()
     actual_record = bt_cls.results.error[0]
     self.assertIs(actual_record.termination_signal.exception,
-            expected_termination_signal)
+                  expected_termination_signal)
     self.assertIsNotNone(actual_record.termination_signal.stacktrace)
     self.assertEqual(len(actual_record.extra_errors), 1)
     extra_error = actual_record.extra_errors['teardown_test']
@@ -836,6 +869,7 @@
     expected_extra_error = Exception('teardown_test Exception.')
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         raise expected_extra_error
 
@@ -854,6 +888,7 @@
     """
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def teardown_test(self):
         asserts.assert_true(False, MSG_EXPECTED_EXCEPTION)
 
@@ -867,14 +902,16 @@
     self.assertEqual(actual_record.details, 'Test Passed!')
     self.assertIsNone(actual_record.extras)
     self.assertEqual(actual_record.extra_errors['teardown_test'].details,
-             MSG_EXPECTED_EXCEPTION)
+                     MSG_EXPECTED_EXCEPTION)
     self.assertIsNone(actual_record.extra_errors['teardown_test'].extras)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_pass_cannot_modify_original_record(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_pass(self, record):
         record.test_name = 'blah'
 
@@ -887,13 +924,14 @@
     self.assertEqual(actual_record.test_name, 'test_something')
 
   def test_on_pass_raise_exception(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_pass(self, record):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
       def test_something(self):
-        asserts.explicit_pass(MSG_EXPECTED_EXCEPTION,
-                    extras=MOCK_EXTRA)
+        asserts.explicit_pass(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run()
@@ -902,13 +940,15 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
     self.assertEqual(actual_record.extra_errors['on_pass'].details,
-             MSG_EXPECTED_EXCEPTION)
+                     MSG_EXPECTED_EXCEPTION)
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_on_fail_raise_exception(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def on_fail(self, record):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -922,9 +962,9 @@
     self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
     self.assertEqual(actual_record.extra_errors['on_fail'].details,
-             MSG_EXPECTED_EXCEPTION)
+                     MSG_EXPECTED_EXCEPTION)
     expected_summary = ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_abort_class_setup_class(self):
@@ -936,6 +976,7 @@
     """
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         asserts.abort_class(MSG_EXPECTED_EXCEPTION)
 
@@ -952,11 +993,13 @@
     bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertEqual(len(bt_cls.results.skipped), 3)
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 0, Failed 0, Passed 0, "
-              "Requested 3, Skipped 3"))
+                     ("Error 0, Executed 0, Failed 0, Passed 0, "
+                      "Requested 3, Skipped 3"))
 
   def test_abort_class_in_setup_test(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         asserts.abort_class(MSG_EXPECTED_EXCEPTION)
 
@@ -973,11 +1016,13 @@
     bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertEqual(len(bt_cls.results.skipped), 2)
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 3, Skipped 2"))
+                     ("Error 0, Executed 1, Failed 1, Passed 0, "
+                      "Requested 3, Skipped 2"))
 
   def test_abort_class_in_on_fail(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
         asserts.fail(MSG_EXPECTED_EXCEPTION)
 
@@ -994,11 +1039,13 @@
     bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertEqual(len(bt_cls.results.skipped), 2)
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 3, Skipped 2"))
+                     ("Error 0, Executed 1, Failed 1, Passed 0, "
+                      "Requested 3, Skipped 2"))
 
   def test_setup_and_teardown_execution_count(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         pass
 
@@ -1017,7 +1064,9 @@
     self.assertEqual(bt_cls.teardown_test.call_count, 2)
 
   def test_abort_class_in_test(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
         pass
 
@@ -1031,14 +1080,15 @@
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertEqual(bt_cls.results.passed[0].test_name, "test_1")
-    self.assertEqual(bt_cls.results.failed[0].details,
-             MSG_EXPECTED_EXCEPTION)
+    self.assertEqual(bt_cls.results.failed[0].details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 2, Failed 1, Passed 1, "
-              "Requested 3, Skipped 1"))
+                     ("Error 0, Executed 2, Failed 1, Passed 1, "
+                      "Requested 3, Skipped 1"))
 
   def test_abort_all_in_setup_class(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         asserts.abort_all(MSG_EXPECTED_EXCEPTION)
 
@@ -1053,15 +1103,17 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 0, Failed 0, Passed 0, "
-              "Requested 3, Skipped 3"))
+                     ("Error 0, Executed 0, Failed 0, Passed 0, "
+                      "Requested 3, Skipped 3"))
 
   def test_abort_all_in_teardown_class(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
         pass
 
@@ -1073,15 +1125,17 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2"])
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 2, Failed 0, Passed 2, "
-              "Requested 2, Skipped 0"))
+                     ("Error 0, Executed 2, Failed 0, Passed 2, "
+                      "Requested 2, Skipped 0"))
 
   def test_abort_all_in_setup_test(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         asserts.abort_all(MSG_EXPECTED_EXCEPTION)
 
@@ -1096,15 +1150,17 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 3, Skipped 2"))
+                     ("Error 0, Executed 1, Failed 1, Passed 0, "
+                      "Requested 3, Skipped 2"))
 
   def test_abort_all_in_on_fail(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
         asserts.fail(MSG_EXPECTED_EXCEPTION)
 
@@ -1119,15 +1175,17 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 1, Failed 1, Passed 0, "
-              "Requested 3, Skipped 2"))
+                     ("Error 0, Executed 1, Failed 1, Passed 0, "
+                      "Requested 3, Skipped 2"))
 
   def test_abort_all_in_on_fail_from_setup_class(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
         asserts.fail(MSG_UNEXPECTED_EXCEPTION)
 
@@ -1145,17 +1203,19 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     setup_class_record = bt_cls.results.error[0]
     self.assertEqual(setup_class_record.test_name, 'setup_class')
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 1, Executed 0, Failed 0, Passed 0, "
-              "Requested 3, Skipped 3"))
+                     ("Error 1, Executed 0, Failed 0, Passed 0, "
+                      "Requested 3, Skipped 3"))
 
   def test_abort_all_in_test(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
         pass
 
@@ -1168,18 +1228,19 @@
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     with self.assertRaisesRegex(signals.TestAbortAll,
-                  MSG_EXPECTED_EXCEPTION) as context:
+                                MSG_EXPECTED_EXCEPTION) as context:
       bt_cls.run(test_names=["test_1", "test_2", "test_3"])
     self.assertTrue(hasattr(context.exception, 'results'))
     self.assertEqual(bt_cls.results.passed[0].test_name, "test_1")
-    self.assertEqual(bt_cls.results.failed[0].details,
-             MSG_EXPECTED_EXCEPTION)
+    self.assertEqual(bt_cls.results.failed[0].details, MSG_EXPECTED_EXCEPTION)
     self.assertEqual(bt_cls.results.summary_str(),
-             ("Error 0, Executed 2, Failed 1, Passed 1, "
-              "Requested 3, Skipped 1"))
+                     ("Error 0, Executed 2, Failed 1, Passed 1, "
+                      "Requested 3, Skipped 1"))
 
   def test_uncaught_exception(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
         never_call()
@@ -1193,12 +1254,14 @@
     # Stacktraces can vary. Just check for key words
     self.assertIn('test_method()', actual_record.stacktrace)
     self.assertIn('raise Exception(MSG_EXPECTED_EXCEPTION)',
-            actual_record.stacktrace)
+                  actual_record.stacktrace)
     self.assertIn('Exception: This is an expected exception.',
-            actual_record.stacktrace)
+                  actual_record.stacktrace)
 
   def test_fail(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.fail(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         never_call()
@@ -1211,11 +1274,11 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_true(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        asserts.assert_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        asserts.assert_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         never_call()
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1226,7 +1289,9 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_equal_pass(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.assert_equal(1, 1, extras=MOCK_EXTRA)
 
@@ -1238,7 +1303,9 @@
     self.assertIsNone(actual_record.extras)
 
   def test_assert_equal_fail(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.assert_equal(1, 2, extras=MOCK_EXTRA)
 
@@ -1250,12 +1317,14 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_equal_fail_with_msg(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.assert_equal(1,
-                   2,
-                   msg=MSG_EXPECTED_EXCEPTION,
-                   extras=MOCK_EXTRA)
+                             2,
+                             msg=MSG_EXPECTED_EXCEPTION,
+                             extras=MOCK_EXTRA)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
     bt_cls.run()
@@ -1266,7 +1335,9 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_raises_pass(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         with asserts.assert_raises(SomeError, extras=MOCK_EXTRA):
           raise SomeError(MSG_EXPECTED_EXCEPTION)
@@ -1279,7 +1350,9 @@
     self.assertIsNone(actual_record.extras)
 
   def test_assert_raises_fail_with_noop(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         with asserts.assert_raises(SomeError, extras=MOCK_EXTRA):
           pass
@@ -1292,7 +1365,9 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_raises_fail_with_wrong_error(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         with asserts.assert_raises(SomeError, extras=MOCK_EXTRA):
           raise AttributeError(MSG_UNEXPECTED_EXCEPTION)
@@ -1305,12 +1380,13 @@
     self.assertIsNone(actual_record.extras)
 
   def test_assert_raises_regex_pass(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        with asserts.assert_raises_regex(
-            SomeError,
-            expected_regex=MSG_EXPECTED_EXCEPTION,
-            extras=MOCK_EXTRA):
+        with asserts.assert_raises_regex(SomeError,
+                                         expected_regex=MSG_EXPECTED_EXCEPTION,
+                                         extras=MOCK_EXTRA):
           raise SomeError(MSG_EXPECTED_EXCEPTION)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1321,12 +1397,13 @@
     self.assertIsNone(actual_record.extras)
 
   def test_assert_raises_regex_fail_with_noop(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        with asserts.assert_raises_regex(
-            SomeError,
-            expected_regex=MSG_EXPECTED_EXCEPTION,
-            extras=MOCK_EXTRA):
+        with asserts.assert_raises_regex(SomeError,
+                                         expected_regex=MSG_EXPECTED_EXCEPTION,
+                                         extras=MOCK_EXTRA):
           pass
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1340,11 +1417,11 @@
     wrong_msg = "ha"
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        with asserts.assert_raises_regex(
-            SomeError,
-            expected_regex=MSG_EXPECTED_EXCEPTION,
-            extras=MOCK_EXTRA):
+        with asserts.assert_raises_regex(SomeError,
+                                         expected_regex=MSG_EXPECTED_EXCEPTION,
+                                         extras=MOCK_EXTRA):
           raise SomeError(wrong_msg)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1352,17 +1429,18 @@
     actual_record = bt_cls.results.failed[0]
     self.assertEqual(actual_record.test_name, "test_func")
     expected_details = ('"This is an expected exception." does not match '
-              '"%s"') % wrong_msg
+                        '"%s"') % wrong_msg
     self.assertEqual(actual_record.details, expected_details)
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_assert_raises_regex_fail_with_wrong_error(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        with asserts.assert_raises_regex(
-            SomeError,
-            expected_regex=MSG_EXPECTED_EXCEPTION,
-            extras=MOCK_EXTRA):
+        with asserts.assert_raises_regex(SomeError,
+                                         expected_regex=MSG_EXPECTED_EXCEPTION,
+                                         extras=MOCK_EXTRA):
           raise AttributeError(MSG_UNEXPECTED_EXCEPTION)
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1373,10 +1451,11 @@
     self.assertIsNone(actual_record.extras)
 
   def test_explicit_pass(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        asserts.explicit_pass(MSG_EXPECTED_EXCEPTION,
-                    extras=MOCK_EXTRA)
+        asserts.explicit_pass(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         never_call()
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1387,7 +1466,9 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_implicit_pass(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         pass
 
@@ -1399,7 +1480,9 @@
     self.assertIsNone(actual_record.extras)
 
   def test_skip(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.skip(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         never_call()
@@ -1414,12 +1497,12 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_skip_if(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         asserts.skip_if(False, MSG_UNEXPECTED_EXCEPTION)
-        asserts.skip_if(True,
-                MSG_EXPECTED_EXCEPTION,
-                extras=MOCK_EXTRA)
+        asserts.skip_if(True, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         never_call()
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1432,7 +1515,9 @@
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_skip_in_setup_test(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
         asserts.skip(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
 
@@ -1453,10 +1538,9 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def on_fail(self, record):
@@ -1476,6 +1560,7 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         expects.expect_true(False, 'msg 1', extras='1')
         expects.expect_true(False, 'msg 2', extras='2')
@@ -1503,10 +1588,9 @@
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def test_2(self):
@@ -1528,16 +1612,13 @@
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_1(self):
-        expects.expect_true(True,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(True, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def test_2(self):
-        expects.expect_false(False,
-                   MSG_EXPECTED_EXCEPTION,
-                   extras=MOCK_EXTRA)
+        expects.expect_false(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1551,10 +1632,9 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def test_func(self):
@@ -1583,19 +1663,16 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_class(self):
-        expects.expect_true(False,
-                  'Failure in setup_class',
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, 'Failure in setup_class', extras=MOCK_EXTRA)
         must_call('ha')
 
       def test_func(self):
         pass
 
       def on_fail(self, record):
-        expects.expect_true(False,
-                  'Failure in on_fail',
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, 'Failure in on_fail', extras=MOCK_EXTRA)
         must_call2('on_fail')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1615,21 +1692,19 @@
     self.assertIsNotNone(setup_class_dict['End Time'])
     self.assertEqual(setup_class_dict['Test Name'], 'setup_class')
     # Verify the on_fail error is recorded in summary result.
-    extra_error_dict = next(iter(
-      setup_class_dict['Extra Errors'].values()))
+    extra_error_dict = next(iter(setup_class_dict['Extra Errors'].values()))
     self.assertEqual(extra_error_dict['Details'], 'Failure in on_fail')
 
   def test_expect_in_teardown_class(self):
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         pass
 
       def teardown_class(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1645,10 +1720,9 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_test(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def test_func(self):
@@ -1671,13 +1745,12 @@
     must_call2 = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         pass
 
       def teardown_test(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
       def on_fail(self, record):
@@ -1696,10 +1769,9 @@
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        expects.expect_false(True,
-                   MSG_EXPECTED_EXCEPTION,
-                   extras=MOCK_EXTRA)
+        expects.expect_false(True, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1714,11 +1786,9 @@
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        expects.expect_equal(1,
-                   2,
-                   MSG_EXPECTED_EXCEPTION,
-                   extras=MOCK_EXTRA)
+        expects.expect_equal(1, 2, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
 
     bt_cls = MockBaseTest(self.mock_test_cls_configs)
@@ -1726,14 +1796,14 @@
     must_call.assert_called_once_with('ha')
     actual_record = bt_cls.results.failed[0]
     self.assertEqual(actual_record.test_name, 'test_func')
-    self.assertEqual(actual_record.details,
-             '1 != 2 ' + MSG_EXPECTED_EXCEPTION)
+    self.assertEqual(actual_record.details, '1 != 2 ' + MSG_EXPECTED_EXCEPTION)
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_expect_no_raises_default_msg(self):
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         with expects.expect_no_raises(extras=MOCK_EXTRA):
           raise Exception(MSG_EXPECTED_EXCEPTION)
@@ -1744,9 +1814,8 @@
     must_call.assert_called_once_with('ha')
     actual_record = bt_cls.results.failed[0]
     self.assertEqual(actual_record.test_name, 'test_func')
-    self.assertEqual(
-      actual_record.details,
-      'Got an unexpected exception: %s' % MSG_EXPECTED_EXCEPTION)
+    self.assertEqual(actual_record.details,
+                     'Got an unexpected exception: %s' % MSG_EXPECTED_EXCEPTION)
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_expect_no_raises_custom_msg(self):
@@ -1754,6 +1823,7 @@
     msg = 'Some step unexpected failed'
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         with expects.expect_no_raises(message=msg, extras=MOCK_EXTRA):
           raise Exception(MSG_EXPECTED_EXCEPTION)
@@ -1765,7 +1835,7 @@
     actual_record = bt_cls.results.failed[0]
     self.assertEqual(actual_record.test_name, 'test_func')
     self.assertEqual(actual_record.details,
-             '%s: %s' % (msg, MSG_EXPECTED_EXCEPTION))
+                     '%s: %s' % (msg, MSG_EXPECTED_EXCEPTION))
     self.assertEqual(actual_record.extras, MOCK_EXTRA)
 
   def test_expect_true_and_assert_true(self):
@@ -1774,10 +1844,9 @@
     must_call = mock.Mock()
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
-        expects.expect_true(False,
-                  MSG_EXPECTED_EXCEPTION,
-                  extras=MOCK_EXTRA)
+        expects.expect_true(False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
         must_call('ha')
         asserts.assert_true(False, 'failed from assert_true')
 
@@ -1802,7 +1871,7 @@
     required = ["something"]
     bc = base_test.BaseTestClass(self.mock_test_cls_configs)
     expected_msg = ('Missing required user param "%s" in test '
-            'configuration.') % required[0]
+                    'configuration.') % required[0]
     with self.assertRaisesRegex(base_test.Error, expected_msg):
       bc.unpack_userparams(required)
 
@@ -1841,7 +1910,7 @@
     """
     bc = base_test.BaseTestClass(self.mock_test_cls_configs)
     bc.unpack_userparams(req_param_names=['a_kwarg_param'],
-               a_kwarg_param="whatever")
+                         a_kwarg_param="whatever")
     self.assertEqual(bc.a_kwarg_param, "whatever")
 
   def test_unpack_userparams_optional_missing(self):
@@ -1858,8 +1927,7 @@
     configs.user_params["something"] = 42
     configs.user_params["something_else"] = 53
     bc = base_test.BaseTestClass(configs)
-    bc.unpack_userparams(req_param_names=required,
-               opt_param_names=optional)
+    bc.unpack_userparams(req_param_names=required, opt_param_names=optional)
     self.assertEqual(bc.something, 42)
     self.assertEqual(bc.something_else, 53)
 
@@ -1891,6 +1959,7 @@
     """
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         raise Exception(MSG_EXPECTED_EXCEPTION)
 
@@ -1908,11 +1977,13 @@
     self.assertEqual(bt_cls.results.skipped, [])
 
   def test_generate_tests_run(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'test_%s_%s' % (a, b)
@@ -1930,12 +2001,14 @@
     self.assertEqual(bt_cls.results.passed[1].test_name, 'test_3_4')
 
   def test_generate_tests_with_uid(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  uid_func=self.uid_logic,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            uid_func=self.uid_logic,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'test_%s_%s' % (a, b)
@@ -1952,12 +2025,14 @@
     self.assertEqual(bt_cls.results.passed[1].uid, 'uid-3-4')
 
   def test_generate_tests_with_none_uid(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  uid_func=self.uid_logic,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            uid_func=self.uid_logic,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'test_%s_%s' % (a, b)
@@ -1976,11 +2051,13 @@
     self.assertEqual(bt_cls.results.passed[1].uid, 'uid-3-4')
 
   def test_generate_tests_selected_run(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'test_%s_%s' % (a, b)
@@ -1995,11 +2072,13 @@
     self.assertEqual(bt_cls.results.passed[0].test_name, 'test_3_4')
 
   def test_generate_tests_call_outside_of_setup_generated_tests(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_ha(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'test_%s_%s' % (a, b)
@@ -2013,19 +2092,20 @@
     utils.validate_test_result(bt_cls.results)
     self.assertEqual(actual_record.test_name, "test_ha")
     self.assertEqual(
-      actual_record.details,
-      '"generate_tests" cannot be called outside of setup_generated_tests'
-    )
+        actual_record.details,
+        '"generate_tests" cannot be called outside of setup_generated_tests')
     expected_summary = ("Error 1, Executed 1, Failed 0, Passed 0, "
-              "Requested 1, Skipped 0")
+                        "Requested 1, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_generate_tests_dup_test_name(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def setup_generated_tests(self):
         self.generate_tests(test_logic=self.logic,
-                  name_func=self.name_gen,
-                  arg_sets=[(1, 2), (3, 4)])
+                            name_func=self.name_gen,
+                            arg_sets=[(1, 2), (3, 4)])
 
       def name_gen(self, a, b):
         return 'ha'
@@ -2038,17 +2118,18 @@
     actual_record = bt_cls.results.error[0]
     self.assertEqual(actual_record.test_name, "setup_generated_tests")
     self.assertEqual(
-      actual_record.details,
-      'During test generation of "logic": Test name "ha" already exists'
-      ', cannot be duplicated!')
+        actual_record.details,
+        'During test generation of "logic": Test name "ha" already exists'
+        ', cannot be duplicated!')
     expected_summary = ("Error 1, Executed 0, Failed 0, Passed 0, "
-              "Requested 0, Skipped 0")
+                        "Requested 0, Skipped 0")
     self.assertEqual(bt_cls.results.summary_str(), expected_summary)
 
   def test_write_user_data(self):
     content = {'a': 1}
 
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_something(self):
         self.record_data(content)
 
@@ -2077,8 +2158,8 @@
     mock_ctrlr_2_config_name = mock_second_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{'serial': 'xxxx', 'magic': 'Magic'}]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
-    mock_test_config.controller_configs[
-      mock_ctrlr_2_config_name] = copy.copy(my_config)
+    mock_test_config.controller_configs[mock_ctrlr_2_config_name] = copy.copy(
+        my_config)
 
     class ControllerInfoTest(base_test.BaseTestClass):
       """Registers two different controller types and modifies controller
@@ -2087,8 +2168,7 @@
 
       def setup_class(self):
         self.register_controller(mock_controller)
-        second_controller = self.register_controller(
-          mock_second_controller)[0]
+        second_controller = self.register_controller(mock_second_controller)[0]
         # This should appear in recorded controller info.
         second_controller.set_magic('haha')
 
@@ -2102,18 +2182,14 @@
     self.assertNotEqual(info1, info2)
     self.assertEqual(info1.test_class, 'ControllerInfoTest')
     self.assertEqual(info1.controller_name, 'MagicDevice')
-    self.assertEqual(info1.controller_info, [{
-      'MyMagic': {
-        'magic': 'Magic'
-      }
-    }])
+    self.assertEqual(info1.controller_info, [{'MyMagic': {'magic': 'Magic'}}])
     self.assertEqual(info2.test_class, 'ControllerInfoTest')
     self.assertEqual(info2.controller_name, 'AnotherMagicDevice')
     self.assertEqual(info2.controller_info, [{
-      'MyOtherMagic': {
-        'magic': 'Magic',
-        'extra_magic': 'haha'
-      }
+        'MyOtherMagic': {
+            'magic': 'Magic',
+            'extra_magic': 'haha'
+        }
     }])
 
   def test_record_controller_info_fail(self):
@@ -2122,8 +2198,8 @@
     mock_ctrlr_2_config_name = mock_second_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{'serial': 'xxxx', 'magic': 'Magic'}]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
-    mock_test_config.controller_configs[
-      mock_ctrlr_2_config_name] = copy.copy(my_config)
+    mock_test_config.controller_configs[mock_ctrlr_2_config_name] = copy.copy(
+        my_config)
 
     class ControllerInfoTest(base_test.BaseTestClass):
       """Registers two different controller types and modifies controller
@@ -2134,8 +2210,7 @@
         device = self.register_controller(mock_controller)[0]
         device.who_am_i = mock.MagicMock()
         device.who_am_i.side_effect = Exception('Some failure')
-        second_controller = self.register_controller(
-          mock_second_controller)[0]
+        second_controller = self.register_controller(mock_second_controller)[0]
         # This should appear in recorded controller info.
         second_controller.set_magic('haha')
 
@@ -2149,10 +2224,10 @@
     self.assertEqual(info.test_class, 'ControllerInfoTest')
     self.assertEqual(info.controller_name, 'AnotherMagicDevice')
     self.assertEqual(info.controller_info, [{
-      'MyOtherMagic': {
-        'magic': 'Magic',
-        'extra_magic': 'haha'
-      }
+        'MyOtherMagic': {
+            'magic': 'Magic',
+            'extra_magic': 'haha'
+        }
     }])
     record = bt_cls.results.error[0]
     print(record.to_dict())
@@ -2160,11 +2235,13 @@
     self.assertIsNotNone(record.begin_time)
     self.assertIsNotNone(record.end_time)
     expected_msg = ('Failed to collect controller info from '
-            'mock_controller: Some failure')
+                    'mock_controller: Some failure')
     self.assertEqual(record.details, expected_msg)
 
   def test_uid(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       @records.uid('some-uid')
       def test_func(self):
         pass
@@ -2175,7 +2252,9 @@
     self.assertEqual(actual_record.uid, 'some-uid')
 
   def test_uid_not_specified(self):
+
     class MockBaseTest(base_test.BaseTestClass):
+
       def test_func(self):
         pass
 
@@ -2188,6 +2267,7 @@
     with self.assertRaisesRegex(ValueError, 'UID cannot be None.'):
 
       class MockBaseTest(base_test.BaseTestClass):
+
         @records.uid(None)
         def not_a_test(self):
           pass
diff --git a/tests/mobly/config_parser_test.py b/tests/mobly/config_parser_test.py
index 2fc8b7d..6901819 100644
--- a/tests/mobly/config_parser_test.py
+++ b/tests/mobly/config_parser_test.py
@@ -65,15 +65,14 @@
     config = config_parser.TestRunConfig()
     expected_value = 'SOME_VALUE'
     self.assertEqual(
-      config.controller_configs.get('NON_EXISTENT_KEY', expected_value),
-      expected_value)
+        config.controller_configs.get('NON_EXISTENT_KEY', expected_value),
+        expected_value)
 
   def test_run_config_user_params_is_already_initialized(self):
     config = config_parser.TestRunConfig()
     expected_value = 'SOME_VALUE'
-    self.assertEqual(
-      config.user_params.get('NON_EXISTENT_KEY', expected_value),
-      expected_value)
+    self.assertEqual(config.user_params.get('NON_EXISTENT_KEY', expected_value),
+                     expected_value)
 
 
 if __name__ == '__main__':
diff --git a/tests/mobly/controller_manager_test.py b/tests/mobly/controller_manager_test.py
index 130a464..e100bb9 100755
--- a/tests/mobly/controller_manager_test.py
+++ b/tests/mobly/controller_manager_test.py
@@ -51,13 +51,13 @@
   def test_register_controller_no_config(self):
     c_manager = controller_manager.ControllerManager('SomeClass', {})
     with self.assertRaisesRegex(signals.ControllerError,
-                  'No corresponding config found for'):
+                                'No corresponding config found for'):
       c_manager.register_controller(mock_controller)
 
   def test_register_controller_no_config_for_not_required(self):
     c_manager = controller_manager.ControllerManager('SomeClass', {})
     self.assertIsNone(
-      c_manager.register_controller(mock_controller, required=False))
+        c_manager.register_controller(mock_controller, required=False))
 
   def test_register_controller_dup_register(self):
     """Verifies correctness of registration, internal tally of controllers
@@ -66,8 +66,8 @@
     """
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     registered_name = 'mock_controller'
     self.assertTrue(registered_name in c_manager._controller_objects)
@@ -82,8 +82,8 @@
   def test_register_controller_return_value(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     magic_devices = c_manager.register_controller(mock_controller)
     self.assertEqual(magic_devices[0].magic, 'magic1')
     self.assertEqual(magic_devices[1].magic, 'magic2')
@@ -91,20 +91,18 @@
   def test_register_controller_change_return_value(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     magic_devices = c_manager.register_controller(mock_controller)
     magic1 = magic_devices.pop(0)
-    self.assertIs(magic1,
-            c_manager._controller_objects['mock_controller'][0])
-    self.assertEqual(
-      len(c_manager._controller_objects['mock_controller']), 2)
+    self.assertIs(magic1, c_manager._controller_objects['mock_controller'][0])
+    self.assertEqual(len(c_manager._controller_objects['mock_controller']), 2)
 
   def test_register_controller_less_than_min_number(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     expected_msg = 'Expected to get at least 3 controller objects, got 2.'
     with self.assertRaisesRegex(signals.ControllerError, expected_msg):
       c_manager.register_controller(mock_controller, min_number=3)
@@ -113,19 +111,19 @@
   def test_get_controller_info_record_not_serializable(self, _):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     record = c_manager.get_controller_info_records()[0]
     actual_controller_info = record.controller_info
     self.assertEqual(actual_controller_info,
-             "[{'MyMagic': 'magic1'}, {'MyMagic': 'magic2'}]")
+                     "[{'MyMagic': 'magic1'}, {'MyMagic': 'magic2'}]")
 
   def test_controller_record_exists_without_get_info(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     get_info = getattr(mock_controller, 'get_info')
     delattr(mock_controller, 'get_info')
     try:
@@ -142,8 +140,8 @@
     mock_get_info_func.return_value = None
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     record = c_manager.get_controller_info_records()[0]
     self.assertIsNone(record.controller_info)
@@ -153,12 +151,12 @@
   @mock.patch('mobly.expects._ExpectErrorRecorder.add_error')
   @mock.patch('tests.lib.mock_controller.get_info')
   def test_get_controller_info_records_error(self, mock_get_info_func,
-                         mock_add_error):
+                                             mock_add_error):
     mock_get_info_func.side_effect = Exception('Record info failed.')
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     self.assertFalse(c_manager.get_controller_info_records())
     mock_add_error.assert_called_once()
@@ -168,36 +166,36 @@
   def test_get_controller_info_records(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     record = c_manager.get_controller_info_records()[0]
     record_dict = record.to_dict()
     record_dict.pop('Timestamp')
     self.assertEqual(
-      record_dict, {
-        'Controller Info': [{
-          'MyMagic': 'magic1'
-        }, {
-          'MyMagic': 'magic2'
-        }],
-        'Controller Name': 'MagicDevice',
-        'Test Class': 'SomeClass'
-      })
+        record_dict, {
+            'Controller Info': [{
+                'MyMagic': 'magic1'
+            }, {
+                'MyMagic': 'magic2'
+            }],
+            'Controller Name': 'MagicDevice',
+            'Test Class': 'SomeClass'
+        })
 
   def test_get_controller_info_without_registration(self):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     self.assertFalse(c_manager.get_controller_info_records())
 
   @mock.patch('tests.lib.mock_controller.destroy')
   def test_unregister_controller(self, mock_destroy_func):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     objects = c_manager.register_controller(mock_controller)
     c_manager.unregister_controllers()
     mock_destroy_func.assert_called_once_with(objects)
@@ -206,12 +204,11 @@
 
   @mock.patch('mobly.expects._ExpectErrorRecorder.add_error')
   @mock.patch('tests.lib.mock_controller.destroy')
-  def test_unregister_controller_error(self, mock_destroy_func,
-                     mock_add_error):
+  def test_unregister_controller_error(self, mock_destroy_func, mock_add_error):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.register_controller(mock_controller)
     mock_destroy_func.side_effect = Exception('Failed in destroy.')
     c_manager.unregister_controllers()
@@ -222,12 +219,11 @@
     self.assertFalse(c_manager._controller_modules)
 
   @mock.patch('tests.lib.mock_controller.destroy')
-  def test_unregister_controller_without_registration(
-      self, mock_destroy_func):
+  def test_unregister_controller_without_registration(self, mock_destroy_func):
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
-    c_manager = controller_manager.ControllerManager(
-      'SomeClass', controller_configs)
+    c_manager = controller_manager.ControllerManager('SomeClass',
+                                                     controller_configs)
     c_manager.unregister_controllers()
     mock_destroy_func.assert_not_called()
     self.assertFalse(c_manager._controller_objects)
diff --git a/tests/mobly/controllers/android_device_lib/adb_test.py b/tests/mobly/controllers/android_device_lib/adb_test.py
index 36e207a..e97eaf2 100755
--- a/tests/mobly/controllers/android_device_lib/adb_test.py
+++ b/tests/mobly/controllers/android_device_lib/adb_test.py
@@ -24,27 +24,27 @@
 MOCK_INSTRUMENTATION_PACKAGE = 'com.my.instrumentation.tests'
 MOCK_INSTRUMENTATION_RUNNER = 'com.my.instrumentation.runner'
 MOCK_INSTRUMENTATION_OPTIONS = OrderedDict([
-  ('option1', 'value1'),
-  ('option2', 'value2'),
+    ('option1', 'value1'),
+    ('option2', 'value2'),
 ])
 # Mock android instrumentation commands.
 MOCK_BASIC_INSTRUMENTATION_COMMAND = ('am instrument -r -w  com.my'
-                    '.instrumentation.tests/com.android'
-                    '.common.support.test.runner'
-                    '.AndroidJUnitRunner')
+                                      '.instrumentation.tests/com.android'
+                                      '.common.support.test.runner'
+                                      '.AndroidJUnitRunner')
 MOCK_RUNNER_INSTRUMENTATION_COMMAND = ('am instrument -r -w  com.my'
-                     '.instrumentation.tests/com.my'
-                     '.instrumentation.runner')
+                                       '.instrumentation.tests/com.my'
+                                       '.instrumentation.runner')
 MOCK_OPTIONS_INSTRUMENTATION_COMMAND = ('am instrument -r -w -e option1 value1'
-                    ' -e option2 value2 com.my'
-                    '.instrumentation.tests/com.android'
-                    '.common.support.test.runner'
-                    '.AndroidJUnitRunner')
+                                        ' -e option2 value2 com.my'
+                                        '.instrumentation.tests/com.android'
+                                        '.common.support.test.runner'
+                                        '.AndroidJUnitRunner')
 
 # Mock root command outputs.
 MOCK_ROOT_SUCCESS_OUTPUT = 'adbd is already running as root'
 MOCK_ROOT_ERROR_OUTPUT = (
-  'adb: unable to connect for root: closed'.encode('utf-8'))
+    'adb: unable to connect for root: closed'.encode('utf-8'))
 
 # Mock Shell Command
 MOCK_SHELL_COMMAND = 'ls'
@@ -68,8 +68,8 @@
     mock_psutil_process.return_value = mock.Mock()
 
     mock_proc.communicate = mock.Mock(
-      return_value=(MOCK_DEFAULT_STDOUT.encode('utf-8'),
-              MOCK_DEFAULT_STDERR.encode('utf-8')))
+        return_value=(MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                      MOCK_DEFAULT_STDERR.encode('utf-8')))
     mock_proc.returncode = 0
     return (mock_psutil_process, mock_popen)
 
@@ -81,33 +81,29 @@
     mock_popen.return_value.stdout.readline.side_effect = ['']
 
     mock_proc.communicate = mock.Mock(
-      return_value=('', MOCK_DEFAULT_STDERR.encode('utf-8')))
+        return_value=('', MOCK_DEFAULT_STDERR.encode('utf-8')))
     mock_proc.returncode = 0
     return mock_popen
 
   @mock.patch('mobly.utils.run_command')
   def test_exec_cmd_no_timeout_success(self, mock_run_command):
-    mock_run_command.return_value = (0,
-                     MOCK_DEFAULT_STDOUT.encode('utf-8'),
-                     MOCK_DEFAULT_STDERR.encode('utf-8'))
+    mock_run_command.return_value = (0, MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                                     MOCK_DEFAULT_STDERR.encode('utf-8'))
     out = adb.AdbProxy()._exec_cmd(['fake_cmd'],
-                     shell=False,
-                     timeout=None,
-                     stderr=None)
+                                   shell=False,
+                                   timeout=None,
+                                   stderr=None)
     self.assertEqual(MOCK_DEFAULT_STDOUT, out.decode('utf-8'))
-    mock_run_command.assert_called_with(['fake_cmd'],
-                      shell=False,
-                      timeout=None)
+    mock_run_command.assert_called_with(['fake_cmd'], shell=False, timeout=None)
 
   @mock.patch('mobly.utils.run_command')
   def test_exec_cmd_error_with_serial(self, mock_run_command):
     # Return 1 for retcode for error.
-    mock_run_command.return_value = (1,
-                     MOCK_DEFAULT_STDOUT.encode('utf-8'),
-                     MOCK_DEFAULT_STDERR.encode('utf-8'))
+    mock_run_command.return_value = (1, MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                                     MOCK_DEFAULT_STDERR.encode('utf-8'))
     mock_serial = 'ABCD1234'
     with self.assertRaisesRegex(adb.AdbError,
-                  'Error executing adb cmd .*') as context:
+                                'Error executing adb cmd .*') as context:
       adb.AdbProxy(mock_serial).fake_cmd()
     self.assertEqual(context.exception.serial, mock_serial)
     self.assertIn(mock_serial, context.exception.cmd)
@@ -115,34 +111,28 @@
   @mock.patch('mobly.utils.run_command')
   def test_exec_cmd_error_without_serial(self, mock_run_command):
     # Return 1 for retcode for error.
-    mock_run_command.return_value = (1,
-                     MOCK_DEFAULT_STDOUT.encode('utf-8'),
-                     MOCK_DEFAULT_STDERR.encode('utf-8'))
+    mock_run_command.return_value = (1, MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                                     MOCK_DEFAULT_STDERR.encode('utf-8'))
     with self.assertRaisesRegex(adb.AdbError,
-                  'Error executing adb cmd .*') as context:
+                                'Error executing adb cmd .*') as context:
       adb.AdbProxy()._exec_cmd(['fake_cmd'],
-                   shell=False,
-                   timeout=None,
-                   stderr=None)
+                               shell=False,
+                               timeout=None,
+                               stderr=None)
     self.assertFalse(context.exception.serial)
-    mock_run_command.assert_called_with(['fake_cmd'],
-                      shell=False,
-                      timeout=None)
+    mock_run_command.assert_called_with(['fake_cmd'], shell=False, timeout=None)
 
   @mock.patch('mobly.utils.run_command')
   def test_exec_cmd_with_timeout_success(self, mock_run_command):
-    mock_run_command.return_value = (0,
-                     MOCK_DEFAULT_STDOUT.encode('utf-8'),
-                     MOCK_DEFAULT_STDERR.encode('utf-8'))
+    mock_run_command.return_value = (0, MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                                     MOCK_DEFAULT_STDERR.encode('utf-8'))
 
     out = adb.AdbProxy()._exec_cmd(['fake_cmd'],
-                     shell=False,
-                     timeout=1,
-                     stderr=None)
+                                   shell=False,
+                                   timeout=1,
+                                   stderr=None)
     self.assertEqual(MOCK_DEFAULT_STDOUT, out.decode('utf-8'))
-    mock_run_command.assert_called_with(['fake_cmd'],
-                      shell=False,
-                      timeout=1)
+    mock_run_command.assert_called_with(['fake_cmd'], shell=False, timeout=1)
 
   @mock.patch('mobly.utils.run_command')
   def test_exec_cmd_timed_out(self, mock_run_command):
@@ -165,11 +155,11 @@
 
   def test_exec_cmd_with_negative_timeout_value(self):
     with self.assertRaisesRegex(ValueError,
-                  'Timeout is not a positive value: -1'):
+                                'Timeout is not a positive value: -1'):
       adb.AdbProxy()._exec_cmd(['fake_cmd'],
-                   shell=False,
-                   timeout=-1,
-                   stderr=None)
+                               shell=False,
+                               timeout=-1,
+                               stderr=None)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   def test_execute_and_process_stdout_reads_stdout(self, mock_popen):
@@ -178,45 +168,44 @@
     mock_handler = mock.MagicMock()
 
     err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
-                             shell=False,
-                             handler=mock_handler)
+                                                     shell=False,
+                                                     handler=mock_handler)
     self.assertEqual(mock_handler.call_count, 2)
     mock_handler.assert_any_call('1')
     mock_handler.assert_any_call('2')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
-  def test_execute_and_process_stdout_reads_unexpected_stdout(
-      self, mock_popen):
+  def test_execute_and_process_stdout_reads_unexpected_stdout(self, mock_popen):
     unexpected_stdout = MOCK_DEFAULT_STDOUT.encode('utf-8')
 
     self._mock_execute_and_process_stdout_process(mock_popen)
     mock_handler = mock.MagicMock()
     mock_popen.return_value.communicate = mock.Mock(
-      return_value=(unexpected_stdout,
-              MOCK_DEFAULT_STDERR.encode('utf-8')))
+        return_value=(unexpected_stdout, MOCK_DEFAULT_STDERR.encode('utf-8')))
 
     err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
-                             shell=False,
-                             handler=mock_handler)
+                                                     shell=False,
+                                                     handler=mock_handler)
     self.assertEqual(mock_handler.call_count, 1)
     mock_handler.assert_called_with(unexpected_stdout)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   @mock.patch('logging.debug')
   def test_execute_and_process_stdout_logs_cmd(self, mock_debug_logger,
-                         mock_popen):
+                                               mock_popen):
     raw_expected_stdout = ''
     expected_stdout = '[elided, processed via handler]'
     expected_stderr = MOCK_DEFAULT_STDERR.encode('utf-8')
     self._mock_execute_and_process_stdout_process(mock_popen)
     mock_popen.return_value.communicate = mock.Mock(
-      return_value=(raw_expected_stdout, expected_stderr))
+        return_value=(raw_expected_stdout, expected_stderr))
 
-    err = adb.AdbProxy()._execute_and_process_stdout(
-      ['fake_cmd'], shell=False, handler=mock.MagicMock())
+    err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
+                                                     shell=False,
+                                                     handler=mock.MagicMock())
     mock_debug_logger.assert_called_with(
-      'cmd: %s, stdout: %s, stderr: %s, ret: %s', 'fake_cmd',
-      expected_stdout, expected_stderr, 0)
+        'cmd: %s, stdout: %s, stderr: %s, ret: %s', 'fake_cmd', expected_stdout,
+        expected_stderr, 0)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   @mock.patch('logging.debug')
@@ -228,26 +217,25 @@
 
     self._mock_execute_and_process_stdout_process(mock_popen)
     mock_popen.return_value.communicate = mock.Mock(
-      return_value=(raw_expected_stdout, expected_stderr))
+        return_value=(raw_expected_stdout, expected_stderr))
 
-    err = adb.AdbProxy()._execute_and_process_stdout(
-      ['fake_cmd'], shell=False, handler=mock.MagicMock())
+    err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
+                                                     shell=False,
+                                                     handler=mock.MagicMock())
     mock_debug_logger.assert_called_with(
-      'cmd: %s, stdout: %s, stderr: %s, ret: %s', 'fake_cmd',
-      expected_stdout, expected_stderr, 0)
+        'cmd: %s, stdout: %s, stderr: %s, ret: %s', 'fake_cmd', expected_stdout,
+        expected_stderr, 0)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   def test_execute_and_process_stdout_despite_cmd_exits(self, mock_popen):
     self._mock_execute_and_process_stdout_process(mock_popen)
     mock_popen.return_value.poll.side_effect = [None, 0]
-    mock_popen.return_value.stdout.readline.side_effect = [
-      '1', '2', '3', ''
-    ]
+    mock_popen.return_value.stdout.readline.side_effect = ['1', '2', '3', '']
     mock_handler = mock.MagicMock()
 
     err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
-                             shell=False,
-                             handler=mock_handler)
+                                                     shell=False,
+                                                     handler=mock_handler)
 
     self.assertEqual(mock_handler.call_count, 3)
     mock_handler.assert_any_call('1')
@@ -257,14 +245,12 @@
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   def test_execute_and_process_stdout_when_cmd_eof(self, mock_popen):
     self._mock_execute_and_process_stdout_process(mock_popen)
-    mock_popen.return_value.stdout.readline.side_effect = [
-      '1', '2', '3', ''
-    ]
+    mock_popen.return_value.stdout.readline.side_effect = ['1', '2', '3', '']
     mock_handler = mock.MagicMock()
 
     err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
-                             shell=False,
-                             handler=mock_handler)
+                                                     shell=False,
+                                                     handler=mock_handler)
 
     self.assertEqual(mock_handler.call_count, 3)
     mock_handler.assert_any_call('1')
@@ -275,8 +261,9 @@
   def test_execute_and_process_stdout_returns_stderr(self, mock_popen):
     self._mock_execute_and_process_stdout_process(mock_popen)
 
-    err = adb.AdbProxy()._execute_and_process_stdout(
-      ['fake_cmd'], shell=False, handler=mock.MagicMock())
+    err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
+                                                     shell=False,
+                                                     handler=mock.MagicMock())
     self.assertEqual(MOCK_DEFAULT_STDERR, err.decode('utf-8'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@@ -284,141 +271,137 @@
     self._mock_execute_and_process_stdout_process(mock_popen)
     mock_popen.return_value.returncode = 1
 
-    with self.assertRaisesRegex(adb.AdbError,
-                  'Error executing adb cmd .*'):
-      err = adb.AdbProxy()._execute_and_process_stdout(
-        ['fake_cmd'], shell=False, handler=mock.MagicMock())
+    with self.assertRaisesRegex(adb.AdbError, 'Error executing adb cmd .*'):
+      err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
+                                                       shell=False,
+                                                       handler=mock.MagicMock())
 
   @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
   def test_execute_and_process_stdout_when_handler_crash(self, mock_popen):
     self._mock_execute_and_process_stdout_process(mock_popen)
-    mock_popen.return_value.stdout.readline.side_effect = [
-      '1', '2', '3', ''
-    ]
+    mock_popen.return_value.stdout.readline.side_effect = ['1', '2', '3', '']
     mock_handler = mock.MagicMock()
     mock_handler.side_effect = ['', TypeError('fake crash'), '', '']
 
     with self.assertRaisesRegex(TypeError, 'fake crash'):
-      err = adb.AdbProxy()._execute_and_process_stdout(
-        ['fake_cmd'], shell=False, handler=mock_handler)
+      err = adb.AdbProxy()._execute_and_process_stdout(['fake_cmd'],
+                                                       shell=False,
+                                                       handler=mock_handler)
 
     mock_popen.return_value.communicate.assert_called_once_with()
 
   def test_construct_adb_cmd(self):
-    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
-                          'arg1',
-                          shell=False)
+    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell', 'arg1', shell=False)
     self.assertEqual(adb_cmd, ['adb', 'shell', 'arg1'])
 
   def test_construct_adb_cmd_with_one_command(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell ls /asdafsfd/asdf-asfd/asa', [], shell=False)
+        'shell ls /asdafsfd/asdf-asfd/asa', [], shell=False)
     self.assertEqual(adb_cmd, ['adb', 'shell ls /asdafsfd/asdf-asfd/asa'])
 
   def test_construct_adb_cmd_with_one_arg_command(self):
-    adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell', 'ls /asdafsfd/asdf-asfd/asa', shell=False)
-    self.assertEqual(adb_cmd,
-             ['adb', 'shell', 'ls /asdafsfd/asdf-asfd/asa'])
+    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
+                                                'ls /asdafsfd/asdf-asfd/asa',
+                                                shell=False)
+    self.assertEqual(adb_cmd, ['adb', 'shell', 'ls /asdafsfd/asdf-asfd/asa'])
 
   def test_construct_adb_cmd_with_one_arg_command_list(self):
-    adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell', ['ls /asdafsfd/asdf-asfd/asa'], shell=False)
-    self.assertEqual(adb_cmd,
-             ['adb', 'shell', 'ls /asdafsfd/asdf-asfd/asa'])
+    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
+                                                ['ls /asdafsfd/asdf-asfd/asa'],
+                                                shell=False)
+    self.assertEqual(adb_cmd, ['adb', 'shell', 'ls /asdafsfd/asdf-asfd/asa'])
 
   def test_construct_adb_cmd_with_special_characters(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
-                          ['a b', '"blah"', r'\/\/'],
-                          shell=False)
+                                                ['a b', '"blah"', r'\/\/'],
+                                                shell=False)
     self.assertEqual(adb_cmd, ['adb', 'shell', 'a b', '"blah"', r"\/\/"])
 
   def test_construct_adb_cmd_with_serial(self):
     adb_cmd = adb.AdbProxy('12345')._construct_adb_cmd('shell',
-                               'arg1',
-                               shell=False)
+                                                       'arg1',
+                                                       shell=False)
     self.assertEqual(adb_cmd, ['adb', '-s', '12345', 'shell', 'arg1'])
 
   def test_construct_adb_cmd_with_list(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell', ['arg1', 'arg2'],
-                          shell=False)
+                                                shell=False)
     self.assertEqual(adb_cmd, ['adb', 'shell', 'arg1', 'arg2'])
 
   def test_construct_adb_cmd_with_serial_with_list(self):
     adb_cmd = adb.AdbProxy('12345')._construct_adb_cmd('shell',
-                               ['arg1', 'arg2'],
-                               shell=False)
-    self.assertEqual(adb_cmd,
-             ['adb', '-s', '12345', 'shell', 'arg1', 'arg2'])
+                                                       ['arg1', 'arg2'],
+                                                       shell=False)
+    self.assertEqual(adb_cmd, ['adb', '-s', '12345', 'shell', 'arg1', 'arg2'])
 
   def test_construct_adb_cmd_with_shell_true(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
-                          'arg1 arg2',
-                          shell=True)
+                                                'arg1 arg2',
+                                                shell=True)
     self.assertEqual(adb_cmd, '"adb" shell arg1 arg2')
 
   def test_construct_adb_cmd_with_shell_true_with_one_command(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell ls /asdafsfd/asdf-asfd/asa', [], shell=True)
+        'shell ls /asdafsfd/asdf-asfd/asa', [], shell=True)
     self.assertEqual(adb_cmd, '"adb" shell ls /asdafsfd/asdf-asfd/asa ')
 
   def test_construct_adb_cmd_with_shell_true_with_one_arg_command(self):
-    adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell', 'ls /asdafsfd/asdf-asfd/asa', shell=True)
+    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
+                                                'ls /asdafsfd/asdf-asfd/asa',
+                                                shell=True)
     self.assertEqual(adb_cmd, '"adb" shell ls /asdafsfd/asdf-asfd/asa')
 
   def test_construct_adb_cmd_with_shell_true_with_one_arg_command_list(self):
-    adb_cmd = adb.AdbProxy()._construct_adb_cmd(
-      'shell', ['ls /asdafsfd/asdf-asfd/asa'], shell=True)
+    adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
+                                                ['ls /asdafsfd/asdf-asfd/asa'],
+                                                shell=True)
     self.assertEqual(adb_cmd, '"adb" shell \'ls /asdafsfd/asdf-asfd/asa\'')
 
   def test_construct_adb_cmd_with_shell_true_with_auto_quotes(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell',
-                          ['a b', '"blah"', r'\/\/'],
-                          shell=True)
+                                                ['a b', '"blah"', r'\/\/'],
+                                                shell=True)
     self.assertEqual(adb_cmd, '"adb" shell \'a b\' \'"blah"\' \'\\/\\/\'')
 
   def test_construct_adb_cmd_with_shell_true_with_serial(self):
     adb_cmd = adb.AdbProxy('12345')._construct_adb_cmd('shell',
-                               'arg1 arg2',
-                               shell=True)
+                                                       'arg1 arg2',
+                                                       shell=True)
     self.assertEqual(adb_cmd, '"adb" -s "12345" shell arg1 arg2')
 
   def test_construct_adb_cmd_with_shell_true_with_list(self):
     adb_cmd = adb.AdbProxy()._construct_adb_cmd('shell', ['arg1', 'arg2'],
-                          shell=True)
+                                                shell=True)
     self.assertEqual(adb_cmd, '"adb" shell arg1 arg2')
 
   def test_construct_adb_cmd_with_shell_true_with_serial_with_list(self):
     adb_cmd = adb.AdbProxy('12345')._construct_adb_cmd('shell',
-                               ['arg1', 'arg2'],
-                               shell=True)
+                                                       ['arg1', 'arg2'],
+                                                       shell=True)
     self.assertEqual(adb_cmd, '"adb" -s "12345" shell arg1 arg2')
 
   def test_exec_adb_cmd(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = MOCK_DEFAULT_COMMAND_OUTPUT
       adb.AdbProxy().shell(['arg1', 'arg2'])
-      mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', 'arg1', 'arg2'],
-        shell=False,
-        timeout=None,
-        stderr=None)
+      mock_exec_cmd.assert_called_once_with(['adb', 'shell', 'arg1', 'arg2'],
+                                            shell=False,
+                                            timeout=None,
+                                            stderr=None)
 
   def test_exec_adb_cmd_with_shell_true(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = MOCK_DEFAULT_COMMAND_OUTPUT
       adb.AdbProxy().shell('arg1 arg2', shell=True)
       mock_exec_cmd.assert_called_once_with('"adb" shell arg1 arg2',
-                          shell=True,
-                          timeout=None,
-                          stderr=None)
+                                            shell=True,
+                                            timeout=None,
+                                            stderr=None)
 
   def test_exec_adb_cmd_formats_command(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
-      with mock.patch.object(
-          adb.AdbProxy,
-          '_construct_adb_cmd') as mock_construct_adb_cmd:
+      with mock.patch.object(adb.AdbProxy,
+                             '_construct_adb_cmd') as mock_construct_adb_cmd:
         mock_adb_cmd = mock.MagicMock()
         mock_adb_args = mock.MagicMock()
         mock_construct_adb_cmd.return_value = mock_adb_cmd
@@ -426,124 +409,117 @@
 
         adb.AdbProxy().shell(mock_adb_args)
         mock_construct_adb_cmd.assert_called_once_with('shell',
-                                 mock_adb_args,
-                                 shell=False)
+                                                       mock_adb_args,
+                                                       shell=False)
         mock_exec_cmd.assert_called_once_with(mock_adb_cmd,
-                            shell=False,
-                            timeout=None,
-                            stderr=None)
+                                              shell=False,
+                                              timeout=None,
+                                              stderr=None)
 
   def test_exec_adb_cmd_formats_command_with_shell_true(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
-      with mock.patch.object(
-          adb.AdbProxy,
-          '_construct_adb_cmd') as mock_construct_adb_cmd:
+      with mock.patch.object(adb.AdbProxy,
+                             '_construct_adb_cmd') as mock_construct_adb_cmd:
         mock_adb_cmd = mock.MagicMock()
         mock_adb_args = mock.MagicMock()
         mock_construct_adb_cmd.return_value = mock_adb_cmd
 
         adb.AdbProxy().shell(mock_adb_args, shell=True)
         mock_construct_adb_cmd.assert_called_once_with('shell',
-                                 mock_adb_args,
-                                 shell=True)
+                                                       mock_adb_args,
+                                                       shell=True)
         mock_exec_cmd.assert_called_once_with(mock_adb_cmd,
-                            shell=True,
-                            timeout=None,
-                            stderr=None)
+                                              shell=True,
+                                              timeout=None,
+                                              stderr=None)
 
   def test_execute_adb_and_process_stdout_formats_command(self):
-    with mock.patch.object(adb.AdbProxy, '_execute_and_process_stdout'
-                 ) as mock_execute_and_process_stdout:
-      with mock.patch.object(
-          adb.AdbProxy,
-          '_construct_adb_cmd') as mock_construct_adb_cmd:
+    with mock.patch.object(
+        adb.AdbProxy,
+        '_execute_and_process_stdout') as mock_execute_and_process_stdout:
+      with mock.patch.object(adb.AdbProxy,
+                             '_construct_adb_cmd') as mock_construct_adb_cmd:
         mock_adb_cmd = mock.MagicMock()
         mock_adb_args = mock.MagicMock()
         mock_handler = mock.MagicMock()
         mock_construct_adb_cmd.return_value = mock_adb_cmd
 
-        adb.AdbProxy()._execute_adb_and_process_stdout(
-          'shell', mock_adb_args, shell=False, handler=mock_handler)
+        adb.AdbProxy()._execute_adb_and_process_stdout('shell',
+                                                       mock_adb_args,
+                                                       shell=False,
+                                                       handler=mock_handler)
         mock_construct_adb_cmd.assert_called_once_with('shell',
-                                 mock_adb_args,
-                                 shell=False)
+                                                       mock_adb_args,
+                                                       shell=False)
         mock_execute_and_process_stdout.assert_called_once_with(
-          mock_adb_cmd, shell=False, handler=mock_handler)
+            mock_adb_cmd, shell=False, handler=mock_handler)
 
   @mock.patch('mobly.utils.run_command')
   def test_exec_adb_cmd_with_stderr_pipe(self, mock_run_command):
-    mock_run_command.return_value = (0,
-                     MOCK_DEFAULT_STDOUT.encode('utf-8'),
-                     MOCK_DEFAULT_STDERR.encode('utf-8'))
+    mock_run_command.return_value = (0, MOCK_DEFAULT_STDOUT.encode('utf-8'),
+                                     MOCK_DEFAULT_STDERR.encode('utf-8'))
     stderr_redirect = io.BytesIO()
-    out = adb.AdbProxy().shell('arg1 arg2',
-                   shell=True,
-                   stderr=stderr_redirect)
+    out = adb.AdbProxy().shell('arg1 arg2', shell=True, stderr=stderr_redirect)
     self.assertEqual(MOCK_DEFAULT_STDOUT, out.decode('utf-8'))
     self.assertEqual(MOCK_DEFAULT_STDERR,
-             stderr_redirect.getvalue().decode('utf-8'))
+                     stderr_redirect.getvalue().decode('utf-8'))
 
   def test_getprop(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = b'blah'
       self.assertEqual(adb.AdbProxy().getprop('haha'), 'blah')
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', 'getprop', 'haha'],
-        shell=False,
-        stderr=None,
-        timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
+          ['adb', 'shell', 'getprop', 'haha'],
+          shell=False,
+          stderr=None,
+          timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
 
   def test__parse_getprop_output_special_values(self):
     mock_adb_output = (
-      b'[selinux.restorecon_recursive]: [/data/misc_ce/10]\n'
-      b'[selinux.abc]: [key: value]\n'  # "key: value" as value
-      b'[persist.sys.boot.reason.history]: [reboot,adb,1558549857\n'
-      b'reboot,factory_reset,1558483886\n'  # multi-line value
-      b'reboot,1558483823]\n'
-      b'[persist.something]: [haha\n'
-      b']\n'
-      b'[[wrapped.key]]: [[wrapped value]]\n'
-      b'[persist.byte]: [J\xaa\x8bb\xab\x9dP\x0f]\n'  # non-decodable
+        b'[selinux.restorecon_recursive]: [/data/misc_ce/10]\n'
+        b'[selinux.abc]: [key: value]\n'  # "key: value" as value
+        b'[persist.sys.boot.reason.history]: [reboot,adb,1558549857\n'
+        b'reboot,factory_reset,1558483886\n'  # multi-line value
+        b'reboot,1558483823]\n'
+        b'[persist.something]: [haha\n'
+        b']\n'
+        b'[[wrapped.key]]: [[wrapped value]]\n'
+        b'[persist.byte]: [J\xaa\x8bb\xab\x9dP\x0f]\n'  # non-decodable
     )
     parsed_props = adb.AdbProxy()._parse_getprop_output(mock_adb_output)
     expected_output = {
-      'persist.sys.boot.reason.history':
-      ('reboot,adb,1558549857\nreboot,factory_reset,1558483886\n'
-       'reboot,1558483823'),
-      'selinux.abc':
-      'key: value',
-      'persist.something':
-      'haha\n',
-      'selinux.restorecon_recursive':
-      '/data/misc_ce/10',
-      '[wrapped.key]':
-      '[wrapped value]',
-      'persist.byte':
-      'JbP\x0f',
+        'persist.sys.boot.reason.history':
+            ('reboot,adb,1558549857\nreboot,factory_reset,1558483886\n'
+             'reboot,1558483823'),
+        'selinux.abc': 'key: value',
+        'persist.something': 'haha\n',
+        'selinux.restorecon_recursive': '/data/misc_ce/10',
+        '[wrapped.key]': '[wrapped value]',
+        'persist.byte': 'JbP\x0f',
     }
     self.assertEqual(parsed_props, expected_output)
 
   def test__parse_getprop_output_malformat_output(self):
     mock_adb_output = (
-      b'[selinux.restorecon_recursive][/data/misc_ce/10]\n'  # Malformat
-      b'[persist.sys.boot.reason]: [reboot,adb,1558549857]\n'
-      b'[persist.something]: [haha]\n')
+        b'[selinux.restorecon_recursive][/data/misc_ce/10]\n'  # Malformat
+        b'[persist.sys.boot.reason]: [reboot,adb,1558549857]\n'
+        b'[persist.something]: [haha]\n')
     parsed_props = adb.AdbProxy()._parse_getprop_output(mock_adb_output)
     expected_output = {
-      'persist.sys.boot.reason': 'reboot,adb,1558549857',
-      'persist.something': 'haha'
+        'persist.sys.boot.reason': 'reboot,adb,1558549857',
+        'persist.something': 'haha'
     }
     self.assertEqual(parsed_props, expected_output)
 
   def test__parse_getprop_output_special_line_separator(self):
     mock_adb_output = (
-      b'[selinux.restorecon_recursive][/data/misc_ce/10]\r\n'  # Malformat
-      b'[persist.sys.boot.reason]: [reboot,adb,1558549857]\r\n'
-      b'[persist.something]: [haha]\r\n')
+        b'[selinux.restorecon_recursive][/data/misc_ce/10]\r\n'  # Malformat
+        b'[persist.sys.boot.reason]: [reboot,adb,1558549857]\r\n'
+        b'[persist.something]: [haha]\r\n')
     parsed_props = adb.AdbProxy()._parse_getprop_output(mock_adb_output)
     expected_output = {
-      'persist.sys.boot.reason': 'reboot,adb,1558549857',
-      'persist.something': 'haha'
+        'persist.sys.boot.reason': 'reboot,adb,1558549857',
+        'persist.something': 'haha'
     }
     self.assertEqual(parsed_props, expected_output)
 
@@ -551,47 +527,45 @@
   def test_getprops(self, mock_sleep):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = (
-        b'\n[sendbug.preferred.domain]: [google.com]\n'
-        b'[sys.uidcpupower]: []\n'
-        b'[sys.wifitracing.started]: [1]\n'
-        b'[telephony.lteOnCdmaDevice]: [1]\n\n')
+          b'\n[sendbug.preferred.domain]: [google.com]\n'
+          b'[sys.uidcpupower]: []\n'
+          b'[sys.wifitracing.started]: [1]\n'
+          b'[telephony.lteOnCdmaDevice]: [1]\n\n')
       actual_output = adb.AdbProxy().getprops([
-        'sys.wifitracing.started',  # "numeric" value
-        'sys.uidcpupower',  # empty value
-        'sendbug.preferred.domain',  # string value
-        'nonExistentProp'
+          'sys.wifitracing.started',  # "numeric" value
+          'sys.uidcpupower',  # empty value
+          'sendbug.preferred.domain',  # string value
+          'nonExistentProp'
       ])
       self.assertEqual(
-        actual_output, {
-          'sys.wifitracing.started': '1',
-          'sys.uidcpupower': '',
-          'sendbug.preferred.domain': 'google.com'
-        })
+          actual_output, {
+              'sys.wifitracing.started': '1',
+              'sys.uidcpupower': '',
+              'sendbug.preferred.domain': 'google.com'
+          })
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', 'getprop'],
-        shell=False,
-        stderr=None,
-        timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
+          ['adb', 'shell', 'getprop'],
+          shell=False,
+          stderr=None,
+          timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
       mock_sleep.assert_not_called()
 
   @mock.patch('time.sleep', return_value=mock.MagicMock())
   def test_getprops_when_empty_string_randomly_returned(self, mock_sleep):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.side_effect = [
-        b'',
-        (b'\n[ro.build.id]: [AB42]\n'
-         b'[ro.build.type]: [userdebug]\n\n')
+          b'', (b'\n[ro.build.id]: [AB42]\n'
+                b'[ro.build.type]: [userdebug]\n\n')
       ]
       actual_output = adb.AdbProxy().getprops(['ro.build.id'])
       self.assertEqual(actual_output, {
-        'ro.build.id': 'AB42',
+          'ro.build.id': 'AB42',
       })
       self.assertEqual(mock_exec_cmd.call_count, 2)
-      mock_exec_cmd.assert_called_with(
-        ['adb', 'shell', 'getprop'],
-        shell=False,
-        stderr=None,
-        timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
+      mock_exec_cmd.assert_called_with(['adb', 'shell', 'getprop'],
+                                       shell=False,
+                                       stderr=None,
+                                       timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
       self.assertEqual(mock_sleep.call_count, 1)
       mock_sleep.assert_called_with(1)
 
@@ -602,11 +576,10 @@
       actual_output = adb.AdbProxy().getprops(['ro.build.id'])
       self.assertEqual(actual_output, {})
       self.assertEqual(mock_exec_cmd.call_count, 3)
-      mock_exec_cmd.assert_called_with(
-        ['adb', 'shell', 'getprop'],
-        shell=False,
-        stderr=None,
-        timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
+      mock_exec_cmd.assert_called_with(['adb', 'shell', 'getprop'],
+                                       shell=False,
+                                       stderr=None,
+                                       timeout=adb.DEFAULT_GETPROP_TIMEOUT_SEC)
       self.assertEqual(mock_sleep.call_count, 2)
       mock_sleep.assert_called_with(1)
 
@@ -621,10 +594,10 @@
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       output = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE)
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', MOCK_BASIC_INSTRUMENTATION_COMMAND],
-        shell=False,
-        timeout=None,
-        stderr=None)
+          ['adb', 'shell', MOCK_BASIC_INSTRUMENTATION_COMMAND],
+          shell=False,
+          timeout=None,
+          stderr=None)
       self.assertEqual(output, mock_exec_cmd.return_value)
 
   def test_instrument_with_runner(self):
@@ -632,14 +605,13 @@
     with a runner specified.
     """
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
-      stdout = adb.AdbProxy().instrument(
-        MOCK_INSTRUMENTATION_PACKAGE,
-        runner=MOCK_INSTRUMENTATION_RUNNER)
+      stdout = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE,
+                                         runner=MOCK_INSTRUMENTATION_RUNNER)
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', MOCK_RUNNER_INSTRUMENTATION_COMMAND],
-        shell=False,
-        timeout=None,
-        stderr=None)
+          ['adb', 'shell', MOCK_RUNNER_INSTRUMENTATION_COMMAND],
+          shell=False,
+          timeout=None,
+          stderr=None)
       self.assertEqual(stdout, mock_exec_cmd.return_value)
 
   def test_instrument_with_options(self):
@@ -647,14 +619,13 @@
     with options.
     """
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
-      stdout = adb.AdbProxy().instrument(
-        MOCK_INSTRUMENTATION_PACKAGE,
-        options=MOCK_INSTRUMENTATION_OPTIONS)
+      stdout = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE,
+                                         options=MOCK_INSTRUMENTATION_OPTIONS)
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', MOCK_OPTIONS_INSTRUMENTATION_COMMAND],
-        shell=False,
-        timeout=None,
-        stderr=None)
+          ['adb', 'shell', MOCK_OPTIONS_INSTRUMENTATION_COMMAND],
+          shell=False,
+          timeout=None,
+          stderr=None)
       self.assertEqual(stdout, mock_exec_cmd.return_value)
 
   def test_instrument_with_handler(self):
@@ -665,16 +636,16 @@
     def mock_handler(raw_line):
       pass
 
-    with mock.patch.object(adb.AdbProxy, '_execute_and_process_stdout'
-                 ) as mock_execute_and_process_stdout:
+    with mock.patch.object(
+        adb.AdbProxy,
+        '_execute_and_process_stdout') as mock_execute_and_process_stdout:
       stderr = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE,
-                         handler=mock_handler)
+                                         handler=mock_handler)
       mock_execute_and_process_stdout.assert_called_once_with(
-        ['adb', 'shell', MOCK_BASIC_INSTRUMENTATION_COMMAND],
-        shell=False,
-        handler=mock_handler)
-      self.assertEqual(stderr,
-               mock_execute_and_process_stdout.return_value)
+          ['adb', 'shell', MOCK_BASIC_INSTRUMENTATION_COMMAND],
+          shell=False,
+          handler=mock_handler)
+      self.assertEqual(stderr, mock_execute_and_process_stdout.return_value)
 
   def test_instrument_with_handler_with_runner(self):
     """Verifies the AndroidDevice object's instrument command is correct
@@ -684,18 +655,17 @@
     def mock_handler(raw_line):
       pass
 
-    with mock.patch.object(adb.AdbProxy, '_execute_and_process_stdout'
-                 ) as mock_execute_and_process_stdout:
-      stderr = adb.AdbProxy().instrument(
-        MOCK_INSTRUMENTATION_PACKAGE,
-        runner=MOCK_INSTRUMENTATION_RUNNER,
-        handler=mock_handler)
+    with mock.patch.object(
+        adb.AdbProxy,
+        '_execute_and_process_stdout') as mock_execute_and_process_stdout:
+      stderr = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE,
+                                         runner=MOCK_INSTRUMENTATION_RUNNER,
+                                         handler=mock_handler)
       mock_execute_and_process_stdout.assert_called_once_with(
-        ['adb', 'shell', MOCK_RUNNER_INSTRUMENTATION_COMMAND],
-        shell=False,
-        handler=mock_handler)
-      self.assertEqual(stderr,
-               mock_execute_and_process_stdout.return_value)
+          ['adb', 'shell', MOCK_RUNNER_INSTRUMENTATION_COMMAND],
+          shell=False,
+          handler=mock_handler)
+      self.assertEqual(stderr, mock_execute_and_process_stdout.return_value)
 
   def test_instrument_with_handler_with_options(self):
     """Verifies the AndroidDevice object's instrument command is correct
@@ -705,64 +675,58 @@
     def mock_handler(raw_line):
       pass
 
-    with mock.patch.object(adb.AdbProxy, '_execute_and_process_stdout'
-                 ) as mock_execute_and_process_stdout:
-      stderr = adb.AdbProxy().instrument(
-        MOCK_INSTRUMENTATION_PACKAGE,
-        options=MOCK_INSTRUMENTATION_OPTIONS,
-        handler=mock_handler)
+    with mock.patch.object(
+        adb.AdbProxy,
+        '_execute_and_process_stdout') as mock_execute_and_process_stdout:
+      stderr = adb.AdbProxy().instrument(MOCK_INSTRUMENTATION_PACKAGE,
+                                         options=MOCK_INSTRUMENTATION_OPTIONS,
+                                         handler=mock_handler)
       mock_execute_and_process_stdout.assert_called_once_with(
-        ['adb', 'shell', MOCK_OPTIONS_INSTRUMENTATION_COMMAND],
-        shell=False,
-        handler=mock_handler)
-      self.assertEqual(stderr,
-               mock_execute_and_process_stdout.return_value)
+          ['adb', 'shell', MOCK_OPTIONS_INSTRUMENTATION_COMMAND],
+          shell=False,
+          handler=mock_handler)
+      self.assertEqual(stderr, mock_execute_and_process_stdout.return_value)
 
   @mock.patch.object(adb.AdbProxy, '_exec_cmd')
   def test_root_success(self, mock_exec_cmd):
     mock_exec_cmd.return_value = MOCK_ROOT_SUCCESS_OUTPUT
     output = adb.AdbProxy().root()
-    mock_exec_cmd.assert_called_once_with(
-      ['adb', 'root'],
-      shell=False,
-      timeout=None,
-      stderr=None)
+    mock_exec_cmd.assert_called_once_with(['adb', 'root'],
+                                          shell=False,
+                                          timeout=None,
+                                          stderr=None)
     self.assertEqual(output, MOCK_ROOT_SUCCESS_OUTPUT)
 
   @mock.patch('time.sleep', return_value=mock.MagicMock())
   @mock.patch.object(adb.AdbProxy, '_exec_cmd')
   def test_root_success_with_retry(self, mock_exec_cmd, mock_sleep):
     mock_exec_cmd.side_effect = [
-      adb.AdbError('adb root', '', MOCK_ROOT_ERROR_OUTPUT, 1),
-      MOCK_ROOT_SUCCESS_OUTPUT]
+        adb.AdbError('adb root', '', MOCK_ROOT_ERROR_OUTPUT, 1),
+        MOCK_ROOT_SUCCESS_OUTPUT
+    ]
     output = adb.AdbProxy().root()
-    mock_exec_cmd.assert_called_with(
-      ['adb', 'root'],
-      shell=False,
-      timeout=None,
-      stderr=None)
+    mock_exec_cmd.assert_called_with(['adb', 'root'],
+                                     shell=False,
+                                     timeout=None,
+                                     stderr=None)
     self.assertEqual(output, MOCK_ROOT_SUCCESS_OUTPUT)
     self.assertEqual(mock_sleep.call_count, 1)
     mock_sleep.assert_called_with(10)
 
   @mock.patch('time.sleep', return_value=mock.MagicMock())
   @mock.patch.object(adb.AdbProxy, '_exec_cmd')
-  def test_root_raises_adb_error_when_all_retries_failed(self, mock_exec_cmd,
-                               mock_sleep):
-    mock_exec_cmd.side_effect = adb.AdbError('adb root',
-                         '',
-                         MOCK_ROOT_ERROR_OUTPUT,
-                         1)
+  def test_root_raises_adb_error_when_all_retries_failed(
+      self, mock_exec_cmd, mock_sleep):
+    mock_exec_cmd.side_effect = adb.AdbError('adb root', '',
+                                             MOCK_ROOT_ERROR_OUTPUT, 1)
     expected_msg = ('Error executing adb cmd "adb root". '
-            'ret: 1, stdout: , stderr: %s' %
-            MOCK_ROOT_ERROR_OUTPUT)
+                    'ret: 1, stdout: , stderr: %s' % MOCK_ROOT_ERROR_OUTPUT)
     with self.assertRaisesRegex(adb.AdbError, expected_msg):
       adb.AdbProxy().root()
-      mock_exec_cmd.assert_called_with(
-        ['adb', 'root'],
-        shell=False,
-        timeout=None,
-        stderr=None)
+      mock_exec_cmd.assert_called_with(['adb', 'root'],
+                                       shell=False,
+                                       timeout=None,
+                                       stderr=None)
     self.assertEqual(mock_sleep.call_count, 2)
     mock_sleep.assert_called_with(10)
 
@@ -771,32 +735,29 @@
       mock_exec_cmd.return_value = MOCK_DEFAULT_COMMAND_OUTPUT
       adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND)
       mock_exec_cmd.assert_called_once_with(
-        ['adb', 'shell', 'command', '-v', MOCK_SHELL_COMMAND],
-        shell=False,
-        timeout=None,
-        stderr=None)
+          ['adb', 'shell', 'command', '-v', MOCK_SHELL_COMMAND],
+          shell=False,
+          timeout=None,
+          stderr=None)
 
   def test_has_shell_command_with_existing_command(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = MOCK_COMMAND_OUTPUT
-      self.assertTrue(
-        adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
+      self.assertTrue(adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
 
   def test_has_shell_command_with_missing_command_on_older_devices(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = MOCK_DEFAULT_COMMAND_OUTPUT
-      mock_exec_cmd.side_effect = adb.AdbError(
-        MOCK_ADB_SHELL_COMMAND_CHECK, '', '', 0)
-      self.assertFalse(
-        adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
+      mock_exec_cmd.side_effect = adb.AdbError(MOCK_ADB_SHELL_COMMAND_CHECK, '',
+                                               '', 0)
+      self.assertFalse(adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
 
   def test_has_shell_command_with_missing_command_on_newer_devices(self):
     with mock.patch.object(adb.AdbProxy, '_exec_cmd') as mock_exec_cmd:
       mock_exec_cmd.return_value = MOCK_DEFAULT_COMMAND_OUTPUT
-      mock_exec_cmd.side_effect = adb.AdbError(
-        MOCK_ADB_SHELL_COMMAND_CHECK, '', '', 1)
-      self.assertFalse(
-        adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
+      mock_exec_cmd.side_effect = adb.AdbError(MOCK_ADB_SHELL_COMMAND_CHECK, '',
+                                               '', 1)
+      self.assertFalse(adb.AdbProxy().has_shell_command(MOCK_SHELL_COMMAND))
 
   @mock.patch.object(adb.AdbProxy, 'getprop')
   @mock.patch.object(adb.AdbProxy, '_exec_cmd')
@@ -805,30 +766,28 @@
     mock_exec_cmd.return_value = b'123'
     user_id = adb.AdbProxy().current_user_id
     mock_exec_cmd.assert_called_once_with(
-      ['adb', 'shell', 'am', 'get-current-user'],
-      shell=False,
-      stderr=None,
-      timeout=None)
+        ['adb', 'shell', 'am', 'get-current-user'],
+        shell=False,
+        stderr=None,
+        timeout=None)
     self.assertEqual(user_id, 123)
 
   @mock.patch.object(adb.AdbProxy, 'getprop')
   @mock.patch.object(adb.AdbProxy, '_exec_cmd')
-  def test_current_user_id_between_21_and_24(self, mock_exec_cmd,
-                         mock_getprop):
+  def test_current_user_id_between_21_and_24(self, mock_exec_cmd, mock_getprop):
     mock_getprop.return_value = b'23'
     mock_exec_cmd.return_value = (b'Users:\n'
-                    b'UserInfo{123:Owner:13} serialNo=0\n'
-                    b'Created: <unknown>\n'
-                    b'Last logged in: +1h22m12s497ms ago\n'
-                    b'UserInfo{456:Owner:14} serialNo=0\n'
-                    b'Created: <unknown>\n'
-                    b'Last logged in: +1h01m12s497ms ago\n')
+                                  b'UserInfo{123:Owner:13} serialNo=0\n'
+                                  b'Created: <unknown>\n'
+                                  b'Last logged in: +1h22m12s497ms ago\n'
+                                  b'UserInfo{456:Owner:14} serialNo=0\n'
+                                  b'Created: <unknown>\n'
+                                  b'Last logged in: +1h01m12s497ms ago\n')
     user_id = adb.AdbProxy().current_user_id
-    mock_exec_cmd.assert_called_once_with(
-      ['adb', 'shell', 'dumpsys', 'user'],
-      shell=False,
-      stderr=None,
-      timeout=None)
+    mock_exec_cmd.assert_called_once_with(['adb', 'shell', 'dumpsys', 'user'],
+                                          shell=False,
+                                          stderr=None,
+                                          timeout=None)
     self.assertEqual(user_id, 123)
 
 
diff --git a/tests/mobly/controllers/android_device_lib/callback_handler_test.py b/tests/mobly/controllers/android_device_lib/callback_handler_test.py
index 9476056..5307fb1 100755
--- a/tests/mobly/controllers/android_device_lib/callback_handler_test.py
+++ b/tests/mobly/controllers/android_device_lib/callback_handler_test.py
@@ -20,14 +20,14 @@
 
 MOCK_CALLBACK_ID = "1-0"
 MOCK_RAW_EVENT = {
-  'callbackId': '2-1',
-  'name': 'AsyncTaskResult',
-  'time': 20460228696,
-  'data': {
-    'exampleData': "Here's a simple event.",
-    'successful': True,
-    'secretNumber': 12
-  }
+    'callbackId': '2-1',
+    'name': 'AsyncTaskResult',
+    'time': 20460228696,
+    'data': {
+        'exampleData': "Here's a simple event.",
+        'successful': True,
+        'secretNumber': 12
+    }
 }
 
 
@@ -37,30 +37,27 @@
 
   def test_timeout_value(self):
     self.assertGreaterEqual(jsonrpc_client_base._SOCKET_READ_TIMEOUT,
-                callback_handler.MAX_TIMEOUT)
+                            callback_handler.MAX_TIMEOUT)
 
   def test_callback_id_property(self):
     mock_event_client = mock.Mock()
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
     self.assertEqual(handler.callback_id, MOCK_CALLBACK_ID)
     with self.assertRaisesRegex(AttributeError, "can't set attribute"):
       handler.callback_id = 'ha'
 
   def test_event_dict_to_snippet_event(self):
     mock_event_client = mock.Mock()
-    mock_event_client.eventWaitAndGet = mock.Mock(
-      return_value=MOCK_RAW_EVENT)
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+    mock_event_client.eventWaitAndGet = mock.Mock(return_value=MOCK_RAW_EVENT)
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
     event = handler.waitAndGet('ha')
     self.assertEqual(event.name, MOCK_RAW_EVENT['name'])
     self.assertEqual(event.creation_time, MOCK_RAW_EVENT['time'])
@@ -70,31 +67,26 @@
   def test_wait_and_get_timeout(self):
     mock_event_client = mock.Mock()
     java_timeout_msg = ('com.google.android.mobly.snippet.event.'
-              'EventSnippet$EventSnippetException: timeout.')
+                        'EventSnippet$EventSnippetException: timeout.')
     mock_event_client.eventWaitAndGet = mock.Mock(
-      side_effect=jsonrpc_client_base.ApiError(mock.Mock(),
-                           java_timeout_msg))
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+        side_effect=jsonrpc_client_base.ApiError(mock.Mock(), java_timeout_msg))
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
     expected_msg = 'Timed out after waiting .*s for event "ha" .*'
-    with self.assertRaisesRegex(callback_handler.TimeoutError,
-                  expected_msg):
+    with self.assertRaisesRegex(callback_handler.TimeoutError, expected_msg):
       handler.waitAndGet('ha')
 
   def test_wait_for_event(self):
     mock_event_client = mock.Mock()
-    mock_event_client.eventWaitAndGet = mock.Mock(
-      return_value=MOCK_RAW_EVENT)
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+    mock_event_client.eventWaitAndGet = mock.Mock(return_value=MOCK_RAW_EVENT)
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
 
     def some_condition(event):
       return event.data['successful']
@@ -103,45 +95,41 @@
 
   def test_wait_for_event_negative(self):
     mock_event_client = mock.Mock()
-    mock_event_client.eventWaitAndGet = mock.Mock(
-      return_value=MOCK_RAW_EVENT)
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+    mock_event_client.eventWaitAndGet = mock.Mock(return_value=MOCK_RAW_EVENT)
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
     expected_msg = (
-      'Timed out after 0.01s waiting for an "AsyncTaskResult" event that'
-      ' satisfies the predicate "some_condition".')
+        'Timed out after 0.01s waiting for an "AsyncTaskResult" event that'
+        ' satisfies the predicate "some_condition".')
 
     def some_condition(event):
       return False
 
-    with self.assertRaisesRegex(callback_handler.TimeoutError,
-                  expected_msg):
+    with self.assertRaisesRegex(callback_handler.TimeoutError, expected_msg):
       handler.waitForEvent('AsyncTaskResult', some_condition, 0.01)
 
   def test_wait_for_event_max_timeout(self):
     """waitForEvent should not raise the timeout exceed threshold error.
     """
     mock_event_client = mock.Mock()
-    mock_event_client.eventWaitAndGet = mock.Mock(
-      return_value=MOCK_RAW_EVENT)
-    handler = callback_handler.CallbackHandler(
-      callback_id=MOCK_CALLBACK_ID,
-      event_client=mock_event_client,
-      ret_value=None,
-      method_name=None,
-      ad=mock.Mock())
+    mock_event_client.eventWaitAndGet = mock.Mock(return_value=MOCK_RAW_EVENT)
+    handler = callback_handler.CallbackHandler(callback_id=MOCK_CALLBACK_ID,
+                                               event_client=mock_event_client,
+                                               ret_value=None,
+                                               method_name=None,
+                                               ad=mock.Mock())
 
     def some_condition(event):
       return event.data['successful']
 
     big_timeout = callback_handler.MAX_TIMEOUT * 2
     # This line should not raise.
-    event = handler.waitForEvent(
-      'AsyncTaskResult', some_condition, timeout=big_timeout)
+    event = handler.waitForEvent('AsyncTaskResult',
+                                 some_condition,
+                                 timeout=big_timeout)
 
 
 if __name__ == "__main__":
diff --git a/tests/mobly/controllers/android_device_lib/errors_test.py b/tests/mobly/controllers/android_device_lib/errors_test.py
index 57b87b3..213470c 100755
--- a/tests/mobly/controllers/android_device_lib/errors_test.py
+++ b/tests/mobly/controllers/android_device_lib/errors_test.py
@@ -20,6 +20,7 @@
 
 
 class ErrorsTest(unittest.TestCase):
+
   def test_device_error(self):
     device = mock.MagicMock()
     device.__repr__ = lambda _: '[MockDevice]'
@@ -30,19 +31,19 @@
     device = mock.MagicMock()
     device.__repr__ = lambda _: '[MockDevice]'
     exception = errors.ServiceError(device, 'Some error message.')
-    self.assertEqual(
-      str(exception), '[MockDevice]::Service<None> Some error message.')
+    self.assertEqual(str(exception),
+                     '[MockDevice]::Service<None> Some error message.')
 
   def test_subclass_service_error(self):
+
     class Error(errors.ServiceError):
       SERVICE_TYPE = 'SomeType'
 
     device = mock.MagicMock()
     device.__repr__ = lambda _: '[MockDevice]'
     exception = Error(device, 'Some error message.')
-    self.assertEqual(
-      str(exception),
-      '[MockDevice]::Service<SomeType> Some error message.')
+    self.assertEqual(str(exception),
+                     '[MockDevice]::Service<SomeType> Some error message.')
 
 
 if __name__ == '__main__':
diff --git a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py
index aef3c73..f6a36c6 100755
--- a/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py
+++ b/tests/mobly/controllers/android_device_lib/jsonrpc_client_base_test.py
@@ -24,9 +24,10 @@
 
 
 class FakeRpcClient(jsonrpc_client_base.JsonRpcClientBase):
+
   def __init__(self):
-    super(FakeRpcClient, self).__init__(
-      app_name='FakeRpcClient', ad=mock.Mock())
+    super(FakeRpcClient, self).__init__(app_name='FakeRpcClient',
+                                        ad=mock.Mock())
 
 
 class JsonRpcClientBaseTest(jsonrpc_client_test_base.JsonRpcClientTestBase):
@@ -90,8 +91,8 @@
     Test that when the handshake is given an unknown status then the client
     will not be given a uid.
     """
-    self.setup_mock_socket_file(
-      mock_create_connection, resp=self.MOCK_RESP_UNKNOWN_STATUS)
+    self.setup_mock_socket_file(mock_create_connection,
+                                resp=self.MOCK_RESP_UNKNOWN_STATUS)
     client = FakeRpcClient()
     client.connect()
     self.assertEqual(client.uid, jsonrpc_client_base.UNKNOWN_UID)
@@ -198,7 +199,7 @@
     Logic is the same as test_rpc_send_to_socket.
     """
     fake_file = self.setup_mock_socket_file(
-      mock_create_connection, resp=self.MOCK_RESP_WITHOUT_CALLBACK)
+        mock_create_connection, resp=self.MOCK_RESP_WITHOUT_CALLBACK)
 
     client = FakeRpcClient()
     client.connect()
@@ -229,8 +230,7 @@
     self.assertEqual(next(client._counter), 10)
 
   @mock.patch('socket.create_connection')
-  def test_rpc_verbose_logging_with_long_string(self,
-                          mock_create_connection):
+  def test_rpc_verbose_logging_with_long_string(self, mock_create_connection):
     """Test rpc response fully write into DEBUG level log."""
     fake_file = self.setup_mock_socket_file(mock_create_connection)
     testing_rpc_response = self.generate_rpc_response(4000)
@@ -243,15 +243,14 @@
     self.assertEqual(response, testing_rpc_response)
 
     client.log.debug.assert_called_with('Snippet received: %s',
-                      testing_rpc_response)
+                                        testing_rpc_response)
 
   @mock.patch('socket.create_connection')
-  def test_rpc_truncated_logging_short_response(self,
-                          mock_create_connection):
+  def test_rpc_truncated_logging_short_response(self, mock_create_connection):
     """Test rpc response will full logged when length is short."""
     fake_file = self.setup_mock_socket_file(mock_create_connection)
     testing_rpc_response = self.generate_rpc_response(
-      int(jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH / 2))
+        int(jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH / 2))
     fake_file.resp = testing_rpc_response
 
     client = FakeRpcClient()
@@ -262,16 +261,16 @@
 
     self.assertEqual(response, testing_rpc_response)
     client.log.debug.assert_called_with('Snippet received: %s',
-                      testing_rpc_response)
+                                        testing_rpc_response)
 
   @mock.patch('socket.create_connection')
   def test_rpc_truncated_logging_fit_size_response(self,
-                           mock_create_connection):
+                                                   mock_create_connection):
     """Test rpc response will full logged when length is equal to threshold.
     """
     fake_file = self.setup_mock_socket_file(mock_create_connection)
     testing_rpc_response = self.generate_rpc_response(
-      jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH)
+        jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH)
     fake_file.resp = testing_rpc_response
 
     client = FakeRpcClient()
@@ -282,7 +281,7 @@
 
     self.assertEqual(response, testing_rpc_response)
     client.log.debug.assert_called_with('Snippet received: %s',
-                      testing_rpc_response)
+                                        testing_rpc_response)
 
   @mock.patch('socket.create_connection')
   def test_rpc_truncated_logging_long_response(self, mock_create_connection):
@@ -301,10 +300,9 @@
     self.assertEqual(response, testing_rpc_response)
     # DEBUG level log should truncated by given length.
     client.log.debug.assert_called_with(
-      'Snippet received: %s... %d chars are truncated',
-      testing_rpc_response
-      [:jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH],
-      resp_len - jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH)
+        'Snippet received: %s... %d chars are truncated',
+        testing_rpc_response[:jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH],
+        resp_len - jsonrpc_client_base._MAX_RPC_RESP_LOGGING_LENGTH)
 
 
 if __name__ == '__main__':
diff --git a/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py b/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
index fb9db4f..84379d7 100755
--- a/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
+++ b/tests/mobly/controllers/android_device_lib/jsonrpc_shell_base_test.py
@@ -40,7 +40,7 @@
   @mock.patch.object(android_device, 'get_instances')
   @mock.patch.object(os, 'environ', new={})
   def test_load_device_when_one_device(self, mock_get_instances,
-                     mock_list_adb_devices):
+                                       mock_list_adb_devices):
     mock_list_adb_devices.return_value = ['1234']
     mock_device = mock.MagicMock(spec=android_device.AndroidDevice)
     mock_get_instances.return_value = [mock_device]
@@ -52,7 +52,7 @@
   @mock.patch.object(android_device, 'get_instances')
   @mock.patch.object(os, 'environ', new={'ANDROID_SERIAL': '1234'})
   def test_load_device_when_android_serial(self, mock_get_instances,
-                       mock_list_adb_devices):
+                                           mock_list_adb_devices):
     mock_list_adb_devices.return_value = ['1234', '4321']
     mock_device = mock.MagicMock(spec=android_device.AndroidDevice)
     mock_get_instances.return_value = [mock_device]
@@ -65,7 +65,7 @@
     mock_list_adb_devices.return_value = []
     json_shell = jsonrpc_shell_base.JsonRpcShellBase()
     with self.assertRaisesRegex(jsonrpc_shell_base.Error,
-                  'No adb device found!'):
+                                'No adb device found!'):
       json_shell.load_device()
 
   @mock.patch.object(android_device, 'list_adb_devices')
@@ -74,7 +74,7 @@
     mock_list_adb_devices.return_value = ['1234', '4321']
     json_shell = jsonrpc_shell_base.JsonRpcShellBase()
     with self.assertRaisesRegex(jsonrpc_shell_base.Error,
-                  'Expected one phone.*'):
+                                'Expected one phone.*'):
       json_shell.load_device()
 
   @mock.patch.object(android_device, 'list_adb_devices')
@@ -83,7 +83,7 @@
     mock_list_adb_devices.return_value = ['4321']
     json_shell = jsonrpc_shell_base.JsonRpcShellBase()
     with self.assertRaisesRegex(jsonrpc_shell_base.Error,
-                  'Device "1234" is not found by adb.'):
+                                'Device "1234" is not found by adb.'):
       json_shell.load_device(serial='1234')
 
 
diff --git a/tests/mobly/controllers/android_device_lib/service_manager_test.py b/tests/mobly/controllers/android_device_lib/service_manager_test.py
index 90efb1d..83148ca 100755
--- a/tests/mobly/controllers/android_device_lib/service_manager_test.py
+++ b/tests/mobly/controllers/android_device_lib/service_manager_test.py
@@ -23,6 +23,7 @@
 
 
 class MockService(base_service.BaseService):
+
   def __init__(self, device, configs=None):
     self._device = device
     self._configs = configs
@@ -54,6 +55,7 @@
 
 
 class ServiceManagerTest(unittest.TestCase):
+
   def setUp(self):
     # Reset hidden global `expects` state.
     if sys.version_info < (3, 0):
@@ -64,8 +66,7 @@
 
   def assert_recorded_one_error(self, message):
     self.assertEqual(expects.recorder.error_count, 1)
-    for _, error in (
-        expects.DEFAULT_TEST_RESULT_RECORD.extra_errors.items()):
+    for _, error in (expects.DEFAULT_TEST_RESULT_RECORD.extra_errors.items()):
       self.assertIn(message, error.details)
 
   def test_service_manager_instantiation(self):
@@ -101,17 +102,17 @@
 
   def test_register_not_a_class(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
-    with self.assertRaisesRegex(service_manager.Error,
-                  '.* is not a class!'):
+    with self.assertRaisesRegex(service_manager.Error, '.* is not a class!'):
       manager.register('mock_service', base_service)
 
   def test_register_wrong_subclass_type(self):
+
     class MyClass(object):
       pass
 
     manager = service_manager.ServiceManager(mock.MagicMock())
     with self.assertRaisesRegex(service_manager.Error,
-                  '.* is not a subclass of BaseService!'):
+                                '.* is not a subclass of BaseService!'):
       manager.register('mock_service', MyClass)
 
   def test_register_dup_alias(self):
@@ -141,8 +142,8 @@
     service2 = manager.mock_service2
     service1.ha = mock.MagicMock()
     service2.ha = mock.MagicMock()
-    manager.for_each(lambda service: manager._service_objects.pop(service.
-                                    alias))
+    manager.for_each(
+        lambda service: manager._service_objects.pop(service.alias))
     self.assertFalse(manager._service_objects)
 
   def test_for_each_one_fail(self):
@@ -172,14 +173,14 @@
     service3.create_output_excerpts = mock.MagicMock()
     service1.create_output_excerpts.return_value = ['path/to/1.txt']
     service2.create_output_excerpts.return_value = [
-      'path/to/2-1.txt', 'path/to/2-2.txt'
+        'path/to/2-1.txt', 'path/to/2-2.txt'
     ]
     service3.create_output_excerpts.return_value = []
     mock_test_info = mock.MagicMock(output_path='path/to')
     result = manager.create_output_excerpts_all(mock_test_info)
     self.assertEqual(result['mock_service1'], ['path/to/1.txt'])
     self.assertEqual(result['mock_service2'],
-             ['path/to/2-1.txt', 'path/to/2-2.txt'])
+                     ['path/to/2-1.txt', 'path/to/2-2.txt'])
     self.assertEqual(result['mock_service3'], [])
 
   def test_unregister(self):
@@ -214,7 +215,7 @@
     service.stop_func.side_effect = Exception('Something failed in stop.')
     manager.unregister('mock_service')
     self.assert_recorded_one_error(
-      'Failed to stop service instance "mock_service".')
+        'Failed to stop service instance "mock_service".')
 
   def test_unregister_all(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -241,7 +242,7 @@
     self.assertTrue(service1.is_alive)
     self.assertFalse(service2.is_alive)
     self.assert_recorded_one_error(
-      'Failed to stop service instance "mock_service1".')
+        'Failed to stop service instance "mock_service1".')
 
   def test_start_all(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -257,9 +258,9 @@
     self.assertTrue(service2.is_alive)
     self.assertEqual(service1.start_func.call_count, 1)
     self.assertEqual(service2.start_func.call_count, 1)
-    self.assertEqual(mock_call_tracker.mock_calls,
-             [mock.call.start1(None),
-              mock.call.start2(None)])
+    self.assertEqual(
+        mock_call_tracker.mock_calls,
+        [mock.call.start1(None), mock.call.start2(None)])
 
   def test_start_all_with_already_started_services(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -279,14 +280,12 @@
     manager.register('mock_service1', MockService, start_service=False)
     manager.register('mock_service2', MockService, start_service=False)
     service1 = manager.mock_service1
-    service1.start_func.side_effect = Exception(
-      'Something failed in start.')
+    service1.start_func.side_effect = Exception('Something failed in start.')
     service2 = manager.mock_service2
     manager.start_all()
     self.assertFalse(service1.is_alive)
     self.assertTrue(service2.is_alive)
-    self.assert_recorded_one_error(
-      'Failed to start service "mock_service1"')
+    self.assert_recorded_one_error('Failed to start service "mock_service1"')
 
   def test_stop_all(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -300,9 +299,8 @@
     manager.stop_all()
     self.assertFalse(service1.is_alive)
     self.assertFalse(service2.is_alive)
-    self.assertEqual(
-      mock_call_tracker.mock_calls,
-      [mock.call.stop2(), mock.call.stop1()])
+    self.assertEqual(mock_call_tracker.mock_calls,
+                     [mock.call.stop2(), mock.call.stop1()])
     self.assertEqual(service1.start_func.call_count, 1)
     self.assertEqual(service2.start_func.call_count, 1)
     self.assertEqual(service1.stop_func.call_count, 1)
@@ -328,14 +326,12 @@
     manager.register('mock_service1', MockService)
     manager.register('mock_service2', MockService)
     service1 = manager.mock_service1
-    service1.stop_func.side_effect = Exception(
-      'Something failed in start.')
+    service1.stop_func.side_effect = Exception('Something failed in start.')
     service2 = manager.mock_service2
     manager.stop_all()
     self.assertTrue(service1.is_alive)
     self.assertFalse(service2.is_alive)
-    self.assert_recorded_one_error(
-      'Failed to stop service "mock_service1"')
+    self.assert_recorded_one_error('Failed to stop service "mock_service1"')
 
   def test_start_all_and_stop_all_serveral_times(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -367,8 +363,8 @@
     mock_call_tracker.pause2 = service2.pause_func
     manager.pause_all()
     self.assertEqual(
-      mock_call_tracker.mock_calls,
-      [mock.call.pause2(), mock.call.pause1()])
+        mock_call_tracker.mock_calls,
+        [mock.call.pause2(), mock.call.pause1()])
     self.assertEqual(service1.pause_func.call_count, 1)
     self.assertEqual(service2.pause_func.call_count, 1)
     self.assertEqual(service1.resume_func.call_count, 0)
@@ -379,16 +375,14 @@
     manager.register('mock_service1', MockService)
     manager.register('mock_service2', MockService)
     service1 = manager.mock_service1
-    service1.pause_func.side_effect = Exception(
-      'Something failed in pause.')
+    service1.pause_func.side_effect = Exception('Something failed in pause.')
     service2 = manager.mock_service2
     manager.pause_all()
     self.assertEqual(service1.pause_func.call_count, 1)
     self.assertEqual(service2.pause_func.call_count, 1)
     self.assertEqual(service1.resume_func.call_count, 0)
     self.assertEqual(service2.resume_func.call_count, 0)
-    self.assert_recorded_one_error(
-      'Failed to pause service "mock_service1".')
+    self.assert_recorded_one_error('Failed to pause service "mock_service1".')
 
   def test_resume_all(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -402,8 +396,8 @@
     manager.pause_all()
     manager.resume_all()
     self.assertEqual(
-      mock_call_tracker.mock_calls,
-      [mock.call.resume1(), mock.call.resume2()])
+        mock_call_tracker.mock_calls,
+        [mock.call.resume1(), mock.call.resume2()])
     self.assertEqual(service1.pause_func.call_count, 1)
     self.assertEqual(service2.pause_func.call_count, 1)
     self.assertEqual(service1.resume_func.call_count, 1)
@@ -414,8 +408,7 @@
     manager.register('mock_service1', MockService)
     manager.register('mock_service2', MockService)
     service1 = manager.mock_service1
-    service1.resume_func.side_effect = Exception(
-      'Something failed in resume.')
+    service1.resume_func.side_effect = Exception('Something failed in resume.')
     service2 = manager.mock_service2
     manager.pause_all()
     manager.resume_all()
@@ -423,8 +416,7 @@
     self.assertEqual(service2.pause_func.call_count, 1)
     self.assertEqual(service1.resume_func.call_count, 1)
     self.assertEqual(service2.resume_func.call_count, 1)
-    self.assert_recorded_one_error(
-      'Failed to resume service "mock_service1".')
+    self.assert_recorded_one_error('Failed to resume service "mock_service1".')
 
   def test_list_live_services(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
@@ -447,7 +439,7 @@
   def test_start_services_non_existent(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
     msg = ('.* No service is registered under the name "mock_service", '
-         'cannot start.')
+           'cannot start.')
     with self.assertRaisesRegex(service_manager.Error, msg):
       manager.start_services(['mock_service'])
 
@@ -465,7 +457,7 @@
   def test_resume_services_non_existent(self):
     manager = service_manager.ServiceManager(mock.MagicMock())
     msg = ('.* No service is registered under the name "mock_service", '
-         'cannot resume.')
+           'cannot resume.')
     with self.assertRaisesRegex(service_manager.Error, msg):
       manager.resume_services(['mock_service'])
 
diff --git a/tests/mobly/controllers/android_device_lib/services/base_service_test.py b/tests/mobly/controllers/android_device_lib/services/base_service_test.py
index b8474d2..4fa2c4c 100755
--- a/tests/mobly/controllers/android_device_lib/services/base_service_test.py
+++ b/tests/mobly/controllers/android_device_lib/services/base_service_test.py
@@ -18,6 +18,7 @@
 
 
 class BaseServiceTest(unittest.TestCase):
+
   def setUp(self):
     self.mock_device = mock.MagicMock()
     self.service = base_service.BaseService(self.mock_device)
diff --git a/tests/mobly/controllers/android_device_lib/services/logcat_test.py b/tests/mobly/controllers/android_device_lib/services/logcat_test.py
index 1a59b77..1f36a37 100755
--- a/tests/mobly/controllers/android_device_lib/services/logcat_test.py
+++ b/tests/mobly/controllers/android_device_lib/services/logcat_test.py
@@ -31,24 +31,24 @@
 
 # The expected result of the cat adb operation.
 MOCK_ADB_LOGCAT_CAT_RESULT = [
-  '02-29 14:02:21.456  4454  Something\n',
-  '02-29 14:02:21.789  4454  Something again\n'
+    '02-29 14:02:21.456  4454  Something\n',
+    '02-29 14:02:21.789  4454  Something again\n'
 ]
 # A mocked piece of adb logcat output.
 MOCK_ADB_LOGCAT = (u'02-29 14:02:19.123  4454  Nothing\n'
-           u'%s'
-           u'02-29 14:02:22.123  4454  Something again and again\n'
-           ) % u''.join(MOCK_ADB_LOGCAT_CAT_RESULT)
+                   u'%s'
+                   u'02-29 14:02:22.123  4454  Something again and again\n'
+                  ) % u''.join(MOCK_ADB_LOGCAT_CAT_RESULT)
 # The expected result of the cat adb operation.
 MOCK_ADB_UNICODE_LOGCAT_CAT_RESULT = [
-  '02-29 14:02:21.456  4454  Something \u901a\n',
-  '02-29 14:02:21.789  4454  Something again\n'
+    '02-29 14:02:21.456  4454  Something \u901a\n',
+    '02-29 14:02:21.789  4454  Something again\n'
 ]
 # A mocked piece of adb logcat output.
 MOCK_ADB_UNICODE_LOGCAT = (
-  u'02-29 14:02:19.123  4454  Nothing\n'
-  u'%s'
-  u'02-29 14:02:22.123  4454  Something again and again\n'
+    u'02-29 14:02:19.123  4454  Nothing\n'
+    u'%s'
+    u'02-29 14:02:22.123  4454  Something again and again\n'
 ) % u''.join(MOCK_ADB_UNICODE_LOGCAT_CAT_RESULT)
 
 # Mock start and end time of the adb cat.
@@ -57,11 +57,11 @@
 
 # Mock AdbError for missing logpersist scripts
 MOCK_LOGPERSIST_STOP_MISSING_ADB_ERROR = adb.AdbError(
-  'logpersist.stop --clear', b'',
-  '/system/bin/sh: logpersist.stop: not found', 0)
+    'logpersist.stop --clear', b'',
+    '/system/bin/sh: logpersist.stop: not found', 0)
 MOCK_LOGPERSIST_START_MISSING_ADB_ERROR = adb.AdbError(
-  'logpersist.start --clear', b'',
-  b'/system/bin/sh: logpersist.stop: not found', 0)
+    'logpersist.start --clear', b'',
+    b'/system/bin/sh: logpersist.stop: not found', 0)
 
 
 class LogcatTest(unittest.TestCase):
@@ -90,18 +90,17 @@
     self.assertNotIn(content, output)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_start_and_stop(self, get_timestamp_mock, open_logcat_mock,
-              stop_proc_mock, start_proc_mock, create_dir_mock,
-              FastbootProxy, MockAdbProxy):
+                          stop_proc_mock, start_proc_mock, create_dir_mock,
+                          FastbootProxy, MockAdbProxy):
     """Verifies the steps of collecting adb logcat on an AndroidDevice
     object, including various function calls and the expected behaviors of
     the calls.
@@ -113,18 +112,17 @@
     logcat_service.start()
     # Verify start did the correct operations.
     self.assertTrue(logcat_service._adb_logcat_process)
-    expected_log_path = os.path.join(
-      logging.log_path, 'AndroidDevice%s' % ad.serial,
-      'logcat,%s,fakemodel,123.txt' % ad.serial)
+    expected_log_path = os.path.join(logging.log_path,
+                                     'AndroidDevice%s' % ad.serial,
+                                     'logcat,%s,fakemodel,123.txt' % ad.serial)
     create_dir_mock.assert_called_with(os.path.dirname(expected_log_path))
     adb_cmd = ' "adb" -s %s logcat -v threadtime -T 1  >> %s'
-    start_proc_mock.assert_called_with(
-      adb_cmd % (ad.serial, '"%s" ' % expected_log_path), shell=True)
-    self.assertEqual(logcat_service.adb_logcat_file_path,
-             expected_log_path)
-    expected_msg = (
-      'Logcat thread is already running, cannot start another'
-      ' one.')
+    start_proc_mock.assert_called_with(adb_cmd %
+                                       (ad.serial, '"%s" ' % expected_log_path),
+                                       shell=True)
+    self.assertEqual(logcat_service.adb_logcat_file_path, expected_log_path)
+    expected_msg = ('Logcat thread is already running, cannot start another'
+                    ' one.')
     # Expect error if start is called back to back.
     with self.assertRaisesRegex(logcat.Error, expected_msg):
       logcat_service.start()
@@ -132,21 +130,19 @@
     logcat_service.stop()
     stop_proc_mock.assert_called_with('process')
     self.assertIsNone(logcat_service._adb_logcat_process)
-    self.assertEqual(logcat_service.adb_logcat_file_path,
-             expected_log_path)
+    self.assertEqual(logcat_service.adb_logcat_file_path, expected_log_path)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_update_config(self, open_logcat_mock, stop_proc_mock,
-               start_proc_mock, create_dir_mock, FastbootProxy,
-               MockAdbProxy):
+                         start_proc_mock, create_dir_mock, FastbootProxy,
+                         MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
@@ -155,36 +151,34 @@
     new_log_params = '-a -b -c'
     new_file_path = 'some/path/log.txt'
     new_config = logcat.Config(logcat_params=new_log_params,
-                   output_file_path=new_file_path)
+                               output_file_path=new_file_path)
     logcat_service.update_config(new_config)
     logcat_service.start()
     self.assertTrue(logcat_service._adb_logcat_process)
     create_dir_mock.assert_has_calls([mock.call('some/path')])
     expected_adb_cmd = (' "adb" -s 1 logcat -v threadtime -T 1 -a -b -c >> '
-              '"some/path/log.txt" ')
+                        '"some/path/log.txt" ')
     start_proc_mock.assert_called_with(expected_adb_cmd, shell=True)
-    self.assertEqual(logcat_service.adb_logcat_file_path,
-             'some/path/log.txt')
+    self.assertEqual(logcat_service.adb_logcat_file_path, 'some/path/log.txt')
     logcat_service.stop()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_update_config_while_running(self, open_logcat_mock, stop_proc_mock,
-                     start_proc_mock, create_dir_mock,
-                     FastbootProxy, MockAdbProxy):
+                                       start_proc_mock, create_dir_mock,
+                                       FastbootProxy, MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
     logcat_service.start()
     new_config = logcat.Config(logcat_params='-blah',
-                   output_file_path='some/path/file.txt')
+                               output_file_path='some/path/file.txt')
     with self.assertRaisesRegex(
         logcat.Error,
         'Logcat thread is already running, cannot start another one'):
@@ -193,20 +187,19 @@
     logcat_service.stop()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   @mock.patch(
-    'mobly.controllers.android_device_lib.services.logcat.Logcat.clear_adb_log',
-    return_value=mock_android_device.MockAdbProxy('1'))
+      'mobly.controllers.android_device_lib.services.logcat.Logcat.clear_adb_log',
+      return_value=mock_android_device.MockAdbProxy('1'))
   def test_pause_and_resume(self, clear_adb_mock, open_logcat_mock,
-                stop_proc_mock, start_proc_mock, create_dir_mock,
-                FastbootProxy, MockAdbProxy):
+                            stop_proc_mock, start_proc_mock, create_dir_mock,
+                            FastbootProxy, MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad, logcat.Config(clear_log=True))
@@ -224,45 +217,42 @@
     logcat_service.stop()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch(
-    'mobly.controllers.android_device_lib.services.logcat.Logcat.clear_adb_log',
-    return_value=mock_android_device.MockAdbProxy('1'))
+      'mobly.controllers.android_device_lib.services.logcat.Logcat.clear_adb_log',
+      return_value=mock_android_device.MockAdbProxy('1'))
   def test_logcat_service_create_output_excerpts(self, clear_adb_mock,
-                           stop_proc_mock,
-                           start_proc_mock,
-                           FastbootProxy,
-                           MockAdbProxy):
+                                                 stop_proc_mock,
+                                                 start_proc_mock, FastbootProxy,
+                                                 MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
     logcat_service._start()
 
     def _write_logcat_file_and_assert_excerpts_exists(logcat_file_content,
-                              test_begin_time,
-                              test_name):
+                                                      test_begin_time,
+                                                      test_name):
       with open(logcat_service.adb_logcat_file_path, 'a') as f:
         f.write(logcat_file_content)
       test_output_dir = os.path.join(self.tmp_dir, test_name)
       mock_record = mock.MagicMock()
       mock_record.begin_time = test_begin_time
       test_run_info = runtime_test_info.RuntimeTestInfo(test_name,
-                                test_output_dir,
-                                mock_record)
+                                                        test_output_dir,
+                                                        mock_record)
       actual_path = logcat_service.create_output_excerpts(test_run_info)[0]
       expected_path = os.path.join(
-        test_output_dir, '{test_name}-{test_begin_time}'.format(
-          test_name=test_name, test_begin_time=test_begin_time),
-        'logcat,{mock_serial},fakemodel,{test_name}-{test_begin_time}.txt'
-        .format(
-          mock_serial=mock_serial,
-          test_name=test_name,
-          test_begin_time=test_begin_time))
+          test_output_dir, '{test_name}-{test_begin_time}'.format(
+              test_name=test_name, test_begin_time=test_begin_time),
+          'logcat,{mock_serial},fakemodel,{test_name}-{test_begin_time}.txt'.
+          format(mock_serial=mock_serial,
+                 test_name=test_name,
+                 test_begin_time=test_begin_time))
       self.assertEqual(actual_path, expected_path)
       self.assertTrue(os.path.exists(expected_path))
       return expected_path
@@ -276,18 +266,18 @@
     logcat_service._open_logcat_file()
     FILE_CONTENT = 'Some log.\n'
     expected_path1 = _write_logcat_file_and_assert_excerpts_exists(
-      logcat_file_content=FILE_CONTENT,
-      test_begin_time=123,
-      test_name='test_foo',
+        logcat_file_content=FILE_CONTENT,
+        test_begin_time=123,
+        test_name='test_foo',
     )
     self.AssertFileContains(FILE_CONTENT, expected_path1)
     self.AssertFileDoesNotContain(NOT_IN_EXCERPT, expected_path1)
     # Generate some new logs and do another excerpt.
     FILE_CONTENT = 'Some more logs!!!\n'
     expected_path2 = _write_logcat_file_and_assert_excerpts_exists(
-      logcat_file_content=FILE_CONTENT,
-      test_begin_time=456,
-      test_name='test_bar',
+        logcat_file_content=FILE_CONTENT,
+        test_begin_time=456,
+        test_name='test_bar',
     )
     self.AssertFileContains(FILE_CONTENT, expected_path2)
     self.AssertFileDoesNotContain(FILE_CONTENT, expected_path1)
@@ -295,27 +285,25 @@
     logcat_service.stop()
     FILE_CONTENT = 'Whatever logs\n'
     expected_path3 = _write_logcat_file_and_assert_excerpts_exists(
-      logcat_file_content=FILE_CONTENT,
-      test_begin_time=789,
-      test_name='test_offline',
+        logcat_file_content=FILE_CONTENT,
+        test_begin_time=789,
+        test_name='test_offline',
     )
     self.assertEqual(os.stat(expected_path3).st_size, 0)
 
-
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_take_logcat_with_extra_params(self, get_timestamp_mock,
-                       open_logcat_mock, stop_proc_mock,
-                       start_proc_mock, create_dir_mock,
-                       FastbootProxy, MockAdbProxy):
+                                         open_logcat_mock, stop_proc_mock,
+                                         start_proc_mock, create_dir_mock,
+                                         FastbootProxy, MockAdbProxy):
     """Verifies the steps of collecting adb logcat on an AndroidDevice
     object, including various function calls and the expected behaviors of
     the calls.
@@ -329,21 +317,21 @@
     logcat_service.start()
     # Verify start did the correct operations.
     self.assertTrue(logcat_service._adb_logcat_process)
-    expected_log_path = os.path.join(
-      logging.log_path, 'AndroidDevice%s' % ad.serial,
-      'logcat,%s,fakemodel,123.txt' % ad.serial)
+    expected_log_path = os.path.join(logging.log_path,
+                                     'AndroidDevice%s' % ad.serial,
+                                     'logcat,%s,fakemodel,123.txt' % ad.serial)
     create_dir_mock.assert_called_with(os.path.dirname(expected_log_path))
     adb_cmd = ' "adb" -s %s logcat -v threadtime -T 1 -b radio >> %s'
-    start_proc_mock.assert_called_with(
-      adb_cmd % (ad.serial, '"%s" ' % expected_log_path), shell=True)
-    self.assertEqual(logcat_service.adb_logcat_file_path,
-             expected_log_path)
+    start_proc_mock.assert_called_with(adb_cmd %
+                                       (ad.serial, '"%s" ' % expected_log_path),
+                                       shell=True)
+    self.assertEqual(logcat_service.adb_logcat_file_path, expected_log_path)
     logcat_service.stop()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_instantiation(self, MockFastboot, MockAdbProxy):
     """Verifies the AndroidDevice object's basic attributes are correctly
     set after instantiation.
@@ -355,46 +343,45 @@
     self.assertIsNone(logcat_service.adb_logcat_file_path)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock.MagicMock())
+              return_value=mock.MagicMock())
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  def test__enable_logpersist_with_logpersist(self, MockFastboot,
-                        MockAdbProxy):
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  def test__enable_logpersist_with_logpersist(self, MockFastboot, MockAdbProxy):
     mock_serial = '1'
     mock_adb_proxy = MockAdbProxy.return_value
     mock_adb_proxy.getprops.return_value = {
-      'ro.build.id': 'AB42',
-      'ro.build.type': 'userdebug',
-      'ro.debuggable': '1',
+        'ro.build.id': 'AB42',
+        'ro.build.type': 'userdebug',
+        'ro.debuggable': '1',
     }
     mock_adb_proxy.has_shell_command.side_effect = lambda command: {
-      'logpersist.start': True,
-      'logpersist.stop': True,
+        'logpersist.start': True,
+        'logpersist.stop': True,
     }[command]
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
     logcat_service._enable_logpersist()
     mock_adb_proxy.shell.assert_has_calls([
-      mock.call('logpersist.stop --clear'),
-      mock.call('logpersist.start'),
+        mock.call('logpersist.stop --clear'),
+        mock.call('logpersist.start'),
     ])
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock.MagicMock())
+              return_value=mock.MagicMock())
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test__enable_logpersist_with_user_build_device(self, MockFastboot,
-                             MockAdbProxy):
+                                                     MockAdbProxy):
     mock_serial = '1'
     mock_adb_proxy = MockAdbProxy.return_value
     mock_adb_proxy.getprops.return_value = {
-      'ro.build.id': 'AB42',
-      'ro.build.type': 'user',
-      'ro.debuggable': '0',
+        'ro.build.id': 'AB42',
+        'ro.build.type': 'user',
+        'ro.debuggable': '0',
     }
     mock_adb_proxy.has_shell_command.side_effect = lambda command: {
-      'logpersist.start': True,
-      'logpersist.stop': True,
+        'logpersist.start': True,
+        'logpersist.stop': True,
     }[command]
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
@@ -402,11 +389,12 @@
     mock_adb_proxy.shell.assert_not_called()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock.MagicMock())
+              return_value=mock.MagicMock())
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test__enable_logpersist_with_missing_all_logpersist(
       self, MockFastboot, MockAdbProxy):
+
     def adb_shell_helper(command):
       if command == 'logpersist.start':
         raise MOCK_LOGPERSIST_START_MISSING_ADB_ERROR
@@ -418,13 +406,13 @@
     mock_serial = '1'
     mock_adb_proxy = MockAdbProxy.return_value
     mock_adb_proxy.getprops.return_value = {
-      'ro.build.id': 'AB42',
-      'ro.build.type': 'userdebug',
-      'ro.debuggable': '1',
+        'ro.build.id': 'AB42',
+        'ro.build.type': 'userdebug',
+        'ro.debuggable': '1',
     }
     mock_adb_proxy.has_shell_command.side_effect = lambda command: {
-      'logpersist.start': False,
-      'logpersist.stop': False,
+        'logpersist.start': False,
+        'logpersist.stop': False,
     }[command]
     mock_adb_proxy.shell.side_effect = adb_shell_helper
     ad = android_device.AndroidDevice(serial=mock_serial)
@@ -433,11 +421,12 @@
     mock_adb_proxy.shell.assert_not_called()
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock.MagicMock())
+              return_value=mock.MagicMock())
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test__enable_logpersist_with_missing_logpersist_stop(
       self, MockFastboot, MockAdbProxy):
+
     def adb_shell_helper(command):
       if command == 'logpersist.stop --clear':
         raise MOCK_LOGPERSIST_STOP_MISSING_ADB_ERROR
@@ -447,28 +436,29 @@
     mock_serial = '1'
     mock_adb_proxy = MockAdbProxy.return_value
     mock_adb_proxy.getprops.return_value = {
-      'ro.build.id': 'AB42',
-      'ro.build.type': 'userdebug',
-      'ro.debuggable': '1',
+        'ro.build.id': 'AB42',
+        'ro.build.type': 'userdebug',
+        'ro.debuggable': '1',
     }
     mock_adb_proxy.has_shell_command.side_effect = lambda command: {
-      'logpersist.start': True,
-      'logpersist.stop': False,
+        'logpersist.start': True,
+        'logpersist.stop': False,
     }[command]
     mock_adb_proxy.shell.side_effect = adb_shell_helper
     ad = android_device.AndroidDevice(serial=mock_serial)
     logcat_service = logcat.Logcat(ad)
     logcat_service._enable_logpersist()
     mock_adb_proxy.shell.assert_has_calls([
-      mock.call('logpersist.stop --clear'),
+        mock.call('logpersist.stop --clear'),
     ])
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock.MagicMock())
+              return_value=mock.MagicMock())
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test__enable_logpersist_with_missing_logpersist_start(
       self, MockFastboot, MockAdbProxy):
+
     def adb_shell_helper(command):
       if command == 'logpersist.start':
         raise MOCK_LOGPERSIST_START_MISSING_ADB_ERROR
@@ -478,13 +468,13 @@
     mock_serial = '1'
     mock_adb_proxy = MockAdbProxy.return_value
     mock_adb_proxy.getprops.return_value = {
-      'ro.build.id': 'AB42',
-      'ro.build.type': 'userdebug',
-      'ro.debuggable': '1',
+        'ro.build.id': 'AB42',
+        'ro.build.type': 'userdebug',
+        'ro.debuggable': '1',
     }
     mock_adb_proxy.has_shell_command.side_effect = lambda command: {
-      'logpersist.start': False,
-      'logpersist.stop': True,
+        'logpersist.start': False,
+        'logpersist.stop': True,
     }[command]
     mock_adb_proxy.shell.side_effect = adb_shell_helper
     ad = android_device.AndroidDevice(serial=mock_serial)
@@ -494,16 +484,13 @@
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy')
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_clear_adb_log(self, MockFastboot, MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     ad.adb.logcat = mock.MagicMock()
     ad.adb.logcat.side_effect = adb.AdbError(
-      cmd='cmd',
-      stdout=b'',
-      stderr=b'failed to clear "main" log',
-      ret_code=1)
+        cmd='cmd', stdout=b'', stderr=b'failed to clear "main" log', ret_code=1)
     logcat_service = logcat.Logcat(ad)
     logcat_service.clear_adb_log()
 
diff --git a/tests/mobly/controllers/android_device_lib/services/snippet_management_service_test.py b/tests/mobly/controllers/android_device_lib/services/snippet_management_service_test.py
index 974972a..0be87f7 100755
--- a/tests/mobly/controllers/android_device_lib/services/snippet_management_service_test.py
+++ b/tests/mobly/controllers/android_device_lib/services/snippet_management_service_test.py
@@ -25,7 +25,7 @@
 
   def test_empty_manager_start_stop(self):
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.start()
     # When no client is registered, manager is never alive.
     self.assertFalse(manager.is_alive)
@@ -36,21 +36,21 @@
   def test_get_snippet_client(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     self.assertEqual(manager.get_snippet_client('foo'), mock_client)
 
   @mock.patch(SNIPPET_CLIENT_CLASS_PATH)
   def test_get_snippet_client_fail(self, _):
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     self.assertIsNone(manager.get_snippet_client('foo'))
 
   @mock.patch(SNIPPET_CLIENT_CLASS_PATH)
   def test_stop_with_live_client(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     mock_client.start_app_and_connect.assert_called_once_with()
     manager.stop()
@@ -64,10 +64,10 @@
   @mock.patch(SNIPPET_CLIENT_CLASS_PATH)
   def test_add_snippet_client_dup_name(self, _):
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     msg = ('.* Name "foo" is already registered with package ".*", it '
-         'cannot be used again.')
+           'cannot be used again.')
     with self.assertRaisesRegex(snippet_management_service.Error, msg):
       manager.add_snippet_client('foo', MOCK_PACKAGE + 'ha')
 
@@ -76,10 +76,10 @@
     mock_client = mock_class.return_value
     mock_client.package = MOCK_PACKAGE
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     msg = ('Snippet package "com.mock.package" has already been loaded '
-         'under name "foo".')
+           'under name "foo".')
     with self.assertRaisesRegex(snippet_management_service.Error, msg):
       manager.add_snippet_client('bar', MOCK_PACKAGE)
 
@@ -88,7 +88,7 @@
     mock_client = mock.MagicMock()
     mock_class.return_value = mock_client
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     manager.remove_snippet_client('foo')
     msg = 'No snippet client is registered with name "foo".'
@@ -100,7 +100,7 @@
     mock_client = mock.MagicMock()
     mock_class.return_value = mock_client
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     with self.assertRaisesRegex(
         snippet_management_service.Error,
         'No snippet client is registered with name "foo".'):
@@ -110,7 +110,7 @@
   def test_start_with_live_service(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     mock_client.start_app_and_connect.reset_mock()
     mock_client.is_alive = True
@@ -125,7 +125,7 @@
   def test_pause(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     manager.pause()
     mock_client.clear_host_port.assert_called_once_with()
@@ -134,7 +134,7 @@
   def test_resume_positive_case(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     mock_client.is_alive = True
     mock_client.host_port = None
@@ -145,7 +145,7 @@
   def test_resume_alive_with_host_port(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     mock_client.is_alive = True
     mock_client.host_port = 1
@@ -156,7 +156,7 @@
   def test_resume_not_alive_no_host_port(self, mock_class):
     mock_client = mock_class.return_value
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     mock_client.is_alive = False
     mock_client.host_port = None
@@ -168,7 +168,7 @@
     mock_client = mock.MagicMock()
     mock_class.return_value = mock_client
     manager = snippet_management_service.SnippetManagementService(
-      mock.MagicMock())
+        mock.MagicMock())
     manager.add_snippet_client('foo', MOCK_PACKAGE)
     manager.foo.ha('param')
     mock_client.ha.assert_called_once_with('param')
diff --git a/tests/mobly/controllers/android_device_lib/sl4a_client_test.py b/tests/mobly/controllers/android_device_lib/sl4a_client_test.py
index feff163..2aff335 100755
--- a/tests/mobly/controllers/android_device_lib/sl4a_client_test.py
+++ b/tests/mobly/controllers/android_device_lib/sl4a_client_test.py
@@ -31,50 +31,48 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_start_app_and_connect(self, mock_get_port,
-                   mock_start_standing_subprocess,
-                   mock_create_connection):
+                                 mock_start_standing_subprocess,
+                                 mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess, resp_lines=[b'\n'])
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[b'\n'])
     client = self._make_client()
     client.start_app_and_connect()
     self.assertEqual(8080, client.device_port)
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_app_not_installed(self, mock_get_port,
-                 mock_start_standing_subprocess,
-                 mock_create_connection):
+                             mock_start_standing_subprocess,
+                             mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess, resp_lines=[b'\n'])
-    client = self._make_client(
-      adb_proxy=mock_android_device.MockAdbProxy())
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[b'\n'])
+    client = self._make_client(adb_proxy=mock_android_device.MockAdbProxy())
     with self.assertRaisesRegex(jsonrpc_client_base.AppStartError,
-                  '.* SL4A is not installed on .*'):
+                                '.* SL4A is not installed on .*'):
       client.start_app_and_connect()
 
   def _make_client(self, adb_proxy=None):
     adb_proxy = adb_proxy or mock_android_device.MockAdbProxy(
-      installed_packages=['com.googlecode.android_scripting'])
+        installed_packages=['com.googlecode.android_scripting'])
     ad = mock.Mock()
     ad.adb = adb_proxy
     ad.build_info = {
-      'build_version_codename':
-      ad.adb.getprop('ro.build.version.codename'),
-      'build_version_sdk': ad.adb.getprop('ro.build.version.sdk'),
+        'build_version_codename': ad.adb.getprop('ro.build.version.codename'),
+        'build_version_sdk': ad.adb.getprop('ro.build.version.sdk'),
     }
     return sl4a_client.Sl4aClient(ad=ad)
 
   def _setup_mock_instrumentation_cmd(self, mock_start_standing_subprocess,
-                    resp_lines):
+                                      resp_lines):
     mock_proc = mock_start_standing_subprocess()
     mock_proc.stdout.readline.side_effect = resp_lines
 
diff --git a/tests/mobly/controllers/android_device_lib/snippet_client_test.py b/tests/mobly/controllers/android_device_lib/snippet_client_test.py
index 412edcb..5d3c684 100755
--- a/tests/mobly/controllers/android_device_lib/snippet_client_test.py
+++ b/tests/mobly/controllers/android_device_lib/snippet_client_test.py
@@ -55,29 +55,28 @@
     sc = self._make_client(mock_android_device.MockAdbProxy())
     expected_msg = '.* %s is not installed.' % MOCK_PACKAGE_NAME
     with self.assertRaisesRegex(snippet_client.AppStartPreCheckError,
-                  expected_msg):
+                                expected_msg):
       sc._check_app_installed()
 
   def test_check_app_installed_fail_not_instrumented(self):
     sc = self._make_client(
-      mock_android_device.MockAdbProxy(
-        installed_packages=[MOCK_PACKAGE_NAME]))
+        mock_android_device.MockAdbProxy(
+            installed_packages=[MOCK_PACKAGE_NAME]))
     expected_msg = ('.* %s is installed, but it is not instrumented.' %
-            MOCK_PACKAGE_NAME)
+                    MOCK_PACKAGE_NAME)
     with self.assertRaisesRegex(snippet_client.AppStartPreCheckError,
-                  expected_msg):
+                                expected_msg):
       sc._check_app_installed()
 
   def test_check_app_installed_fail_target_not_installed(self):
     sc = self._make_client(
-      mock_android_device.MockAdbProxy(instrumented_packages=[(
-        MOCK_PACKAGE_NAME,
-        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE,
-        MOCK_MISSING_PACKAGE_NAME)]))
+        mock_android_device.MockAdbProxy(instrumented_packages=[(
+            MOCK_PACKAGE_NAME, snippet_client._INSTRUMENTATION_RUNNER_PACKAGE,
+            MOCK_MISSING_PACKAGE_NAME)]))
     expected_msg = ('.* Instrumentation target %s is not installed.' %
-            MOCK_MISSING_PACKAGE_NAME)
+                    MOCK_MISSING_PACKAGE_NAME)
     with self.assertRaisesRegex(snippet_client.AppStartPreCheckError,
-                  expected_msg):
+                                expected_msg):
       sc._check_app_installed()
 
   @mock.patch('socket.create_connection')
@@ -109,9 +108,9 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_restore_event_client(self, mock_get_port,
-                      mock_create_connection):
+                                        mock_create_connection):
     mock_get_port.return_value = 789
     fake_file = self.setup_mock_socket_file(mock_create_connection)
     client = self._make_client()
@@ -147,25 +146,24 @@
     mock_create_connection.side_effect = IOError('socket timed out')
     with self.assertRaisesRegex(
         jsonrpc_client_base.AppRestoreConnectionError,
-      ('Failed to restore app connection for %s at host port %s, '
-       'device port %s') % (MOCK_PACKAGE_NAME, 789, 456)):
+        ('Failed to restore app connection for %s at host port %s, '
+         'device port %s') % (MOCK_PACKAGE_NAME, 789, 456)):
       client.restore_app_connection()
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_and_connect(self, mock_get_port,
-                       mock_start_standing_subprocess,
-                       mock_create_connection):
+                                         mock_start_standing_subprocess,
+                                         mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'SNIPPET START, PROTOCOL 1 0\n',
-        b'SNIPPET SERVING, PORT 123\n',
-      ])
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[
+                                             b'SNIPPET START, PROTOCOL 1 0\n',
+                                             b'SNIPPET SERVING, PORT 123\n',
+                                         ])
     client = self._make_client()
     client.start_app_and_connect()
     self.assertEqual(123, client.device_port)
@@ -173,9 +171,9 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.stop_standing_subprocess')
+              'utils.stop_standing_subprocess')
   def test_snippet_stop_app(self, mock_stop_standing_subprocess,
-                mock_create_connection):
+                            mock_create_connection):
     adb_proxy = mock.MagicMock()
     adb_proxy.shell.return_value = b'OK (0 tests)'
     client = self._make_client(adb_proxy)
@@ -184,9 +182,9 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient.disconnect')
+              'SnippetClient.disconnect')
   def test_snippet_stop_app_raises(self, mock_disconnect,
-                   mock_create_connection):
+                                   mock_create_connection):
     mock_disconnect.side_effect = Exception('ha')
     adb_proxy = mock.MagicMock()
     adb_proxy.shell.return_value = b'OK (0 tests)'
@@ -198,55 +196,54 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient.'
-    'disable_hidden_api_blacklist')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient.'
+      'disable_hidden_api_blacklist')
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient.'
-    'stop_app')
-  def test_start_app_and_connect_precheck_fail(
-      self, mock_stop, mock_precheck, mock_get_port,
-      mock_start_standing_subprocess, mock_create_connection):
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient.'
+      'stop_app')
+  def test_start_app_and_connect_precheck_fail(self, mock_stop, mock_precheck,
+                                               mock_get_port,
+                                               mock_start_standing_subprocess,
+                                               mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'SNIPPET START, PROTOCOL 1 0\n',
-        b'SNIPPET SERVING, PORT 123\n',
-      ])
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[
+                                             b'SNIPPET START, PROTOCOL 1 0\n',
+                                             b'SNIPPET SERVING, PORT 123\n',
+                                         ])
     client = self._make_client()
     mock_precheck.side_effect = snippet_client.AppStartPreCheckError(
-      client.ad, 'ha')
-    with self.assertRaisesRegex(snippet_client.AppStartPreCheckError,
-                  'ha'):
+        client.ad, 'ha')
+    with self.assertRaisesRegex(snippet_client.AppStartPreCheckError, 'ha'):
       client.start_app_and_connect()
     mock_stop.assert_not_called()
     self.assertFalse(client.is_alive)
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient._start_app_and_connect'
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient._start_app_and_connect'
   )
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient.stop_app'
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient.stop_app'
   )
-  def test_start_app_and_connect_generic_error(
-      self, mock_stop, mock_start, mock_get_port,
-      mock_start_standing_subprocess, mock_create_connection):
+  def test_start_app_and_connect_generic_error(self, mock_stop, mock_start,
+                                               mock_get_port,
+                                               mock_start_standing_subprocess,
+                                               mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'SNIPPET START, PROTOCOL 1 0\n',
-        b'SNIPPET SERVING, PORT 123\n',
-      ])
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[
+                                             b'SNIPPET START, PROTOCOL 1 0\n',
+                                             b'SNIPPET SERVING, PORT 123\n',
+                                         ])
     client = self._make_client()
     mock_start.side_effect = Exception('ha')
     with self.assertRaisesRegex(Exception, 'ha'):
@@ -256,25 +253,24 @@
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient._start_app_and_connect'
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient._start_app_and_connect'
   )
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient.stop_app'
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient.stop_app'
   )
   def test_start_app_and_connect_fail_stop_also_fail(
       self, mock_stop, mock_start, mock_get_port,
       mock_start_standing_subprocess, mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
-    self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'SNIPPET START, PROTOCOL 1 0\n',
-        b'SNIPPET SERVING, PORT 123\n',
-      ])
+    self._setup_mock_instrumentation_cmd(mock_start_standing_subprocess,
+                                         resp_lines=[
+                                             b'SNIPPET START, PROTOCOL 1 0\n',
+                                             b'SNIPPET SERVING, PORT 123\n',
+                                         ])
     client = self._make_client()
     mock_start.side_effect = Exception('Some error')
     mock_stop.side_effect = Exception('Another error')
@@ -284,19 +280,18 @@
     self.assertFalse(client.is_alive)
 
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._do_start_app')
+              'SnippetClient._do_start_app')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._check_app_installed')
+              'SnippetClient._check_app_installed')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._read_protocol_line')
+              'SnippetClient._read_protocol_line')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient.connect')
+              'SnippetClient.connect')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_on_sdk_21(self, mock_get_port, mock_connect,
-                   mock_read_protocol_line,
-                   mock_check_app_installed,
-                   mock_do_start_app):
+                                   mock_read_protocol_line,
+                                   mock_check_app_installed, mock_do_start_app):
     """Check that `--user` is not added to start command on SDK < 24."""
 
     def _mocked_shell(arg):
@@ -307,12 +302,12 @@
 
     mock_get_port.return_value = 123
     mock_read_protocol_line.side_effect = [
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
     ]
 
     # Test 'setsid' exists
@@ -321,23 +316,24 @@
     client._adb.shell = mock.Mock(return_value=b'setsid')
     client.start_app_and_connect()
     cmd_setsid = '%s am instrument  -w -e action start %s/%s' % (
-      snippet_client._SETSID_COMMAND, MOCK_PACKAGE_NAME,
-      snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
+        snippet_client._SETSID_COMMAND, MOCK_PACKAGE_NAME,
+        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
     mock_do_start_app.assert_has_calls([mock.call(cmd_setsid)])
 
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._do_start_app')
+              'SnippetClient._do_start_app')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._check_app_installed')
+              'SnippetClient._check_app_installed')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient._read_protocol_line')
+              'SnippetClient._read_protocol_line')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'SnippetClient.connect')
+              'SnippetClient.connect')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_and_connect_persistent_session(
       self, mock_get_port, mock_connect, mock_read_protocol_line,
       mock_check_app_installed, mock_do_start_app):
+
     def _mocked_shell(arg):
       if 'setsid' in arg:
         raise adb.AdbError('cmd', 'stdout', 'stderr', 'ret_code')
@@ -346,12 +342,12 @@
 
     mock_get_port.return_value = 123
     mock_read_protocol_line.side_effect = [
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
-      'SNIPPET START, PROTOCOL 1 234',
-      'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
+        'SNIPPET START, PROTOCOL 1 234',
+        'SNIPPET SERVING, PORT 1234',
     ]
 
     # Test 'setsid' exists
@@ -359,8 +355,8 @@
     client._adb.shell = mock.Mock(return_value=b'setsid')
     client.start_app_and_connect()
     cmd_setsid = '%s am instrument --user %s -w -e action start %s/%s' % (
-      snippet_client._SETSID_COMMAND, MOCK_USER_ID, MOCK_PACKAGE_NAME,
-      snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
+        snippet_client._SETSID_COMMAND, MOCK_USER_ID, MOCK_PACKAGE_NAME,
+        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
     mock_do_start_app.assert_has_calls([mock.call(cmd_setsid)])
 
     # Test 'setsid' does not exist, but 'nohup' exsits
@@ -368,41 +364,38 @@
     client._adb.shell = _mocked_shell
     client.start_app_and_connect()
     cmd_nohup = '%s am instrument --user %s -w -e action start %s/%s' % (
-      snippet_client._NOHUP_COMMAND, MOCK_USER_ID, MOCK_PACKAGE_NAME,
-      snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
+        snippet_client._NOHUP_COMMAND, MOCK_USER_ID, MOCK_PACKAGE_NAME,
+        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
     mock_do_start_app.assert_has_calls(
-      [mock.call(cmd_setsid),
-       mock.call(cmd_nohup)])
+        [mock.call(cmd_setsid), mock.call(cmd_nohup)])
 
     # Test both 'setsid' and 'nohup' do not exist
     client._adb.shell = mock.Mock(
-      side_effect=adb.AdbError('cmd', 'stdout', 'stderr', 'ret_code'))
+        side_effect=adb.AdbError('cmd', 'stdout', 'stderr', 'ret_code'))
     client = self._make_client()
     client.start_app_and_connect()
     cmd_not_persist = ' am instrument --user %s -w -e action start %s/%s' % (
-      MOCK_USER_ID, MOCK_PACKAGE_NAME,
-      snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
+        MOCK_USER_ID, MOCK_PACKAGE_NAME,
+        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE)
     mock_do_start_app.assert_has_calls([
-      mock.call(cmd_setsid),
-      mock.call(cmd_nohup),
-      mock.call(cmd_not_persist)
+        mock.call(cmd_setsid),
+        mock.call(cmd_nohup),
+        mock.call(cmd_not_persist)
     ])
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_crash(self, mock_get_port,
-                   mock_start_standing_subprocess,
-                   mock_create_connection):
+                                   mock_start_standing_subprocess,
+                                   mock_create_connection):
     mock_get_port.return_value = 456
     self.setup_mock_socket_file(mock_create_connection)
     self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'INSTRUMENTATION_RESULT: shortMsg=Process crashed.\n'
-      ])
+        mock_start_standing_subprocess,
+        resp_lines=[b'INSTRUMENTATION_RESULT: shortMsg=Process crashed.\n'])
     client = self._make_client()
     with self.assertRaisesRegex(
         snippet_client.ProtocolVersionError,
@@ -410,62 +403,62 @@
       client.start_app_and_connect()
 
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_and_connect_unknown_protocol(
       self, mock_get_port, mock_start_standing_subprocess):
     mock_get_port.return_value = 789
     self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[b'SNIPPET START, PROTOCOL 99 0\n'])
+        mock_start_standing_subprocess,
+        resp_lines=[b'SNIPPET START, PROTOCOL 99 0\n'])
     client = self._make_client()
     with self.assertRaisesRegex(snippet_client.ProtocolVersionError,
-                  'SNIPPET START, PROTOCOL 99 0'):
+                                'SNIPPET START, PROTOCOL 99 0'):
       client.start_app_and_connect()
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_and_connect_header_junk(
       self, mock_get_port, mock_start_standing_subprocess,
       mock_create_connection):
     self.setup_mock_socket_file(mock_create_connection)
     self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'This is some header junk\n',
-        b'Some phones print arbitrary output\n',
-        b'SNIPPET START, PROTOCOL 1 0\n',
-        b'Maybe in the middle too\n',
-        b'SNIPPET SERVING, PORT 123\n',
-      ])
+        mock_start_standing_subprocess,
+        resp_lines=[
+            b'This is some header junk\n',
+            b'Some phones print arbitrary output\n',
+            b'SNIPPET START, PROTOCOL 1 0\n',
+            b'Maybe in the middle too\n',
+            b'SNIPPET SERVING, PORT 123\n',
+        ])
     client = self._make_client()
     client.start_app_and_connect()
     self.assertEqual(123, client.device_port)
 
   @mock.patch('socket.create_connection')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.start_standing_subprocess')
+              'utils.start_standing_subprocess')
   @mock.patch('mobly.controllers.android_device_lib.snippet_client.'
-        'utils.get_available_host_port')
+              'utils.get_available_host_port')
   def test_snippet_start_app_and_connect_no_valid_line(
       self, mock_get_port, mock_start_standing_subprocess,
       mock_create_connection):
     mock_get_port.return_value = 456
     self.setup_mock_socket_file(mock_create_connection)
     self._setup_mock_instrumentation_cmd(
-      mock_start_standing_subprocess,
-      resp_lines=[
-        b'This is some header junk\n',
-        b'Some phones print arbitrary output\n',
-        b'',  # readline uses '' to mark EOF
-      ])
+        mock_start_standing_subprocess,
+        resp_lines=[
+            b'This is some header junk\n',
+            b'Some phones print arbitrary output\n',
+            b'',  # readline uses '' to mark EOF
+        ])
     client = self._make_client()
     with self.assertRaisesRegex(jsonrpc_client_base.AppStartError,
-                  'Unexpected EOF waiting for app to start'):
+                                'Unexpected EOF waiting for app to start'):
       client.start_app_and_connect()
 
   @mock.patch(get_print_function_name())
@@ -492,22 +485,20 @@
 
   def _make_client(self, adb_proxy=None):
     adb_proxy = adb_proxy or mock_android_device.MockAdbProxy(
-      instrumented_packages=[(
-        MOCK_PACKAGE_NAME,
-        snippet_client._INSTRUMENTATION_RUNNER_PACKAGE,
-        MOCK_PACKAGE_NAME)])
+        instrumented_packages=[(MOCK_PACKAGE_NAME,
+                                snippet_client._INSTRUMENTATION_RUNNER_PACKAGE,
+                                MOCK_PACKAGE_NAME)])
     ad = mock.Mock()
     ad.adb = adb_proxy
     ad.adb.current_user_id = MOCK_USER_ID
     ad.build_info = {
-      'build_version_codename':
-      ad.adb.getprop('ro.build.version.codename'),
-      'build_version_sdk': ad.adb.getprop('ro.build.version.sdk'),
+        'build_version_codename': ad.adb.getprop('ro.build.version.codename'),
+        'build_version_sdk': ad.adb.getprop('ro.build.version.sdk'),
     }
     return snippet_client.SnippetClient(package=MOCK_PACKAGE_NAME, ad=ad)
 
   def _setup_mock_instrumentation_cmd(self, mock_start_standing_subprocess,
-                    resp_lines):
+                                      resp_lines):
     mock_proc = mock_start_standing_subprocess()
     mock_proc.stdout.readline.side_effect = resp_lines
 
diff --git a/tests/mobly/controllers/android_device_lib/snippet_event_test.py b/tests/mobly/controllers/android_device_lib/snippet_event_test.py
index a995197..d105178 100755
--- a/tests/mobly/controllers/android_device_lib/snippet_event_test.py
+++ b/tests/mobly/controllers/android_device_lib/snippet_event_test.py
@@ -26,15 +26,16 @@
 
 
 class SnippetEventTest(unittest.TestCase):
+
   def test_basic(self):
     """Verifies that an event object can be created and logged properly.
     """
     event = snippet_event.SnippetEvent(MOCK_CALLBACK_ID, MOCK_EVENT_NAME,
-                       MOCK_CREATION_TIME, MOCK_DATA)
+                                       MOCK_CREATION_TIME, MOCK_DATA)
     self.assertEqual(
-      repr(event),
-      "SnippetEvent(callback_id: myCallbackId, name: onXyzEvent, "
-      "creation_time: 12345678, data: {'foo': 'bar'})")
+        repr(event),
+        "SnippetEvent(callback_id: myCallbackId, name: onXyzEvent, "
+        "creation_time: 12345678, data: {'foo': 'bar'})")
 
 
 if __name__ == "__main__":
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index 579b50f..12b4b04 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -62,30 +62,30 @@
   # These tests use mock AndroidDevice instances.
 
   @mock.patch.object(android_device,
-             'get_all_instances',
-             new=mock_android_device.get_all_instances)
+                     'get_all_instances',
+                     new=mock_android_device.get_all_instances)
   @mock.patch.object(android_device,
-             'list_adb_devices',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices',
+                     new=mock_android_device.list_adb_devices)
   @mock.patch.object(android_device,
-             'list_adb_devices_by_usb_id',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices_by_usb_id',
+                     new=mock_android_device.list_adb_devices)
   def test_create_with_pickup_all(self):
     pick_all_token = android_device.ANDROID_DEVICE_PICK_ALL_TOKEN
     actual_ads = android_device.create(pick_all_token)
     for actual, expected in zip(actual_ads,
-                  mock_android_device.get_mock_ads(5)):
+                                mock_android_device.get_mock_ads(5)):
       self.assertEqual(actual.serial, expected.serial)
 
   @mock.patch.object(android_device,
-             'get_instances',
-             new=mock_android_device.get_instances)
+                     'get_instances',
+                     new=mock_android_device.get_instances)
   @mock.patch.object(android_device,
-             'list_adb_devices',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices',
+                     new=mock_android_device.list_adb_devices)
   @mock.patch.object(android_device,
-             'list_adb_devices_by_usb_id',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices_by_usb_id',
+                     new=mock_android_device.list_adb_devices)
   def test_create_with_string_list(self):
     string_list = [u'1', '2']
     actual_ads = android_device.create(string_list)
@@ -93,14 +93,14 @@
       self.assertEqual(actual_ad.serial, expected_serial)
 
   @mock.patch.object(android_device,
-             'get_instances_with_configs',
-             new=mock_android_device.get_instances_with_configs)
+                     'get_instances_with_configs',
+                     new=mock_android_device.get_instances_with_configs)
   @mock.patch.object(android_device,
-             'list_adb_devices',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices',
+                     new=mock_android_device.list_adb_devices)
   @mock.patch.object(android_device,
-             'list_adb_devices_by_usb_id',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices_by_usb_id',
+                     new=mock_android_device.list_adb_devices)
   def test_create_with_dict_list(self):
     string_list = [{'serial': '1'}, {'serial': '2'}]
     actual_ads = android_device.create(string_list)
@@ -108,14 +108,14 @@
       self.assertEqual(actual_ad.serial, expected_serial)
 
   @mock.patch.object(android_device,
-             'get_instances_with_configs',
-             new=mock_android_device.get_instances_with_configs)
+                     'get_instances_with_configs',
+                     new=mock_android_device.get_instances_with_configs)
   @mock.patch.object(android_device,
-             'list_adb_devices',
-             new=mock_android_device.list_adb_devices)
+                     'list_adb_devices',
+                     new=mock_android_device.list_adb_devices)
   @mock.patch.object(android_device,
-             'list_adb_devices_by_usb_id',
-             return_value=['usb:1'])
+                     'list_adb_devices_by_usb_id',
+                     return_value=['usb:1'])
   def test_create_with_usb_id(self, mock_list_adb_devices_by_usb_id):
     string_list = [{'serial': '1'}, {'serial': '2'}, {'serial': 'usb:1'}]
     actual_ads = android_device.create(string_list)
@@ -151,7 +151,7 @@
   def test_get_devices_no_match(self):
     ads = mock_android_device.get_mock_ads(5)
     expected_msg = ('Could not find a target device that matches condition'
-            ": {'label': 'selected'}.")
+                    ": {'label': 'selected'}.")
     with self.assertRaisesRegex(android_device.Error, expected_msg):
       selected_ads = android_device.get_devices(ads, label='selected')
 
@@ -167,15 +167,15 @@
     expected_h_port = 5555
     ads[1].h_port = expected_h_port
     ad = android_device.get_device(ads,
-                     serial=expected_serial,
-                     h_port=expected_h_port)
+                                   serial=expected_serial,
+                                   h_port=expected_h_port)
     self.assertEqual(ad.serial, expected_serial)
     self.assertEqual(ad.h_port, expected_h_port)
 
   def test_get_device_no_match(self):
     ads = mock_android_device.get_mock_ads(5)
     expected_msg = ('Could not find a target device that matches condition'
-            ": {'serial': 5}.")
+                    ": {'serial': 5}.")
     with self.assertRaisesRegex(android_device.Error, expected_msg):
       ad = android_device.get_device(ads, serial=len(ads))
 
@@ -198,7 +198,7 @@
       ad.skip_logcat = False
       ad.is_required = True
     ads[1].services.logcat.start = mock.MagicMock(
-      side_effect=android_device.Error(msg))
+        side_effect=android_device.Error(msg))
     with self.assertRaisesRegex(android_device.Error, msg):
       android_device._start_services_on_ads(ads)
     ads[0].services.stop_all.assert_called_once_with()
@@ -210,58 +210,60 @@
     ads[0].services.logcat.start = mock.MagicMock()
     ads[1].services.logcat.start = mock.MagicMock()
     ads[2].services.logcat.start = mock.MagicMock(
-      side_effect=Exception('Should not have called this.'))
+        side_effect=Exception('Should not have called this.'))
     ads[2].skip_logcat = True
     android_device._start_services_on_ads(ads)
 
   def test_take_bug_reports(self):
     ads = mock_android_device.get_mock_ads(3)
     android_device.take_bug_reports(ads, 'test_something', 'sometime')
-    ads[0].take_bug_report.assert_called_once_with(
-      test_name='test_something',
-      begin_time='sometime',
-      destination=None)
-    ads[1].take_bug_report.assert_called_once_with(
-      test_name='test_something',
-      begin_time='sometime',
-      destination=None)
-    ads[2].take_bug_report.assert_called_once_with(
-      test_name='test_something',
-      begin_time='sometime',
-      destination=None)
+    ads[0].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='sometime',
+                                                   destination=None)
+    ads[1].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='sometime',
+                                                   destination=None)
+    ads[2].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='sometime',
+                                                   destination=None)
 
   def test_take_bug_reports_with_int_begin_time(self):
     ads = mock_android_device.get_mock_ads(3)
     android_device.take_bug_reports(ads, 'test_something', 123)
-    ads[0].take_bug_report.assert_called_once_with(
-      test_name='test_something', begin_time='123', destination=None)
-    ads[1].take_bug_report.assert_called_once_with(
-      test_name='test_something', begin_time='123', destination=None)
-    ads[2].take_bug_report.assert_called_once_with(
-      test_name='test_something', begin_time='123', destination=None)
+    ads[0].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='123',
+                                                   destination=None)
+    ads[1].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='123',
+                                                   destination=None)
+    ads[2].take_bug_report.assert_called_once_with(test_name='test_something',
+                                                   begin_time='123',
+                                                   destination=None)
 
   @mock.patch('mobly.logger.get_log_file_timestamp')
-  def test_take_bug_reports_with_none_values(self,
-                         get_log_file_timestamp_mock):
+  def test_take_bug_reports_with_none_values(self, get_log_file_timestamp_mock):
     mock_timestamp = '07-22-2019_17-55-30-765'
     get_log_file_timestamp_mock.return_value = mock_timestamp
     ads = mock_android_device.get_mock_ads(3)
     android_device.take_bug_reports(ads)
-    ads[0].take_bug_report.assert_called_once_with(
-      test_name=None, begin_time=mock_timestamp, destination=None)
-    ads[1].take_bug_report.assert_called_once_with(
-      test_name=None, begin_time=mock_timestamp, destination=None)
-    ads[2].take_bug_report.assert_called_once_with(
-      test_name=None, begin_time=mock_timestamp, destination=None)
+    ads[0].take_bug_report.assert_called_once_with(test_name=None,
+                                                   begin_time=mock_timestamp,
+                                                   destination=None)
+    ads[1].take_bug_report.assert_called_once_with(test_name=None,
+                                                   begin_time=mock_timestamp,
+                                                   destination=None)
+    ads[2].take_bug_report.assert_called_once_with(test_name=None,
+                                                   begin_time=mock_timestamp,
+                                                   destination=None)
 
   # Tests for android_device.AndroidDevice class.
   # These tests mock out any interaction with the OS and real android device
   # in AndroidDeivce.
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_instantiation(self, MockFastboot, MockAdbProxy):
     """Verifies the AndroidDevice object's basic attributes are correctly
     set after instantiation.
@@ -271,24 +273,20 @@
     self.assertEqual(ad.serial, '1')
     self.assertEqual(ad.model, 'fakemodel')
     expected_lp = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % mock_serial)
+                               'AndroidDevice%s' % mock_serial)
     self.assertEqual(ad.log_path, expected_lp)
     self.assertIsNotNone(ad.services.logcat)
     self.assertIsNotNone(ad.services.snippets)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_load_config(self, create_dir_mock, FastbootProxy,
-                     MockAdbProxy):
+                                     MockAdbProxy):
     mock_serial = '1'
-    config = {
-      'space': 'the final frontier',
-      'number': 1,
-      'debug_tag': 'my_tag'
-    }
+    config = {'space': 'the final frontier', 'number': 1, 'debug_tag': 'my_tag'}
     ad = android_device.AndroidDevice(serial=mock_serial)
     ad.load_config(config)
     self.assertEqual(ad.space, 'the final frontier')
@@ -296,23 +294,23 @@
     self.assertEqual(ad.debug_tag, 'my_tag')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
-  def test_AndroidDevice_load_config_dup(self, create_dir_mock,
-                       FastbootProxy, MockAdbProxy):
+  def test_AndroidDevice_load_config_dup(self, create_dir_mock, FastbootProxy,
+                                         MockAdbProxy):
     mock_serial = '1'
     config = {'serial': 'new_serial'}
     ad = android_device.AndroidDevice(serial=mock_serial)
     with self.assertRaisesRegex(android_device.DeviceError,
-                  'Attribute serial already exists with'):
+                                'Attribute serial already exists with'):
       ad.load_config(config)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_build_info(self, MockFastboot, MockAdbProxy):
     """Verifies the AndroidDevice object's basic attributes are correctly
     set after instantiation.
@@ -328,18 +326,17 @@
     self.assertEqual(build_info['product_name'], 'FakeModel')
     self.assertEqual(build_info['debuggable'], '1')
     self.assertEqual(build_info['hardware'], 'marlin')
-    self.assertEqual(len(build_info),
-             len(android_device.CACHED_SYSTEM_PROPS))
+    self.assertEqual(len(build_info), len(android_device.CACHED_SYSTEM_PROPS))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          '1',
-          mock_properties={
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'userdebug',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  '1',
+                  mock_properties={
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'userdebug',
+                  }))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_build_info_with_minimal_properties(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
@@ -355,9 +352,9 @@
     self.assertEqual(build_info['hardware'], '')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_build_info_cached(self, MockFastboot, MockAdbProxy):
     """Verifies the AndroidDevice object's basic attributes are correctly
     set after instantiation.
@@ -369,39 +366,39 @@
     self.assertEqual(ad.adb.getprops_call_count, 1)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          '1',
-          mock_properties={
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'userdebug',
-            'ro.debuggable': '1',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  '1',
+                  mock_properties={
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'userdebug',
+                      'ro.debuggable': '1',
+                  }))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_is_rootable_when_userdebug_device(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     self.assertTrue(ad.is_rootable)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          '1',
-          mock_properties={
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'user',
-            'ro.debuggable': '0',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  '1',
+                  mock_properties={
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'user',
+                      'ro.debuggable': '0',
+                  }))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  def test_AndroidDevice_is_rootable_when_user_device(
-      self, MockFastboot, MockAdbProxy):
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  def test_AndroidDevice_is_rootable_when_user_device(self, MockFastboot,
+                                                      MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     self.assertFalse(ad.is_rootable)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_device_info(self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial=1)
     device_info = ad.device_info
@@ -416,9 +413,9 @@
     self.assertEqual(device_info['user_added_info']['build_id'], 'CD42')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_serial_is_valid(self, MockFastboot, MockAdbProxy):
     """Verifies that the serial is a primitive string type and serializable.
     """
@@ -433,19 +430,19 @@
     yaml.safe_dump(ad.serial)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_is_emulator_when_realish_device(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     self.assertFalse(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('localhost:123'))
+              return_value=mock_android_device.MockAdbProxy('localhost:123'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('localhost:123'))
+      'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+      return_value=mock_android_device.MockFastbootProxy('localhost:123'))
   def test_AndroidDevice_is_emulator_when_local_networked_device(
       self, MockFastboot, MockAdbProxy):
     # Although these devices are usually emulators, there might be a reason
@@ -453,122 +450,121 @@
     ad = android_device.AndroidDevice(serial='localhost:123')
     self.assertFalse(ad.is_emulator)
 
-  @mock.patch(
-    'mobly.controllers.android_device_lib.adb.AdbProxy',
-    return_value=mock_android_device.MockAdbProxy('example.com:123'))
-  @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('example:123'))
+  @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
+              return_value=mock_android_device.MockAdbProxy('example.com:123'))
+  @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+              return_value=mock_android_device.MockFastbootProxy('example:123'))
   def test_AndroidDevice_is_emulator_when_remote_networked_device(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='example.com:123')
     self.assertFalse(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          'localhost:5554',
-          mock_properties={
-            'ro.hardware': 'ranchu',
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'userdebug',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  'localhost:5554',
+                  mock_properties={
+                      'ro.hardware': 'ranchu',
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'userdebug',
+                  }))
   @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('localhost:5554'))
-  def test_AndroidDevice_is_emulator_when_ranchu_device(
-      self, MockFastboot, MockAdbProxy):
+      'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+      return_value=mock_android_device.MockFastbootProxy('localhost:5554'))
+  def test_AndroidDevice_is_emulator_when_ranchu_device(self, MockFastboot,
+                                                        MockAdbProxy):
     ad = android_device.AndroidDevice(serial='localhost:5554')
     self.assertTrue(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          '1',
-          mock_properties={
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'userdebug',
-            'ro.hardware': 'goldfish',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  '1',
+                  mock_properties={
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'userdebug',
+                      'ro.hardware': 'goldfish',
+                  }))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_is_emulator_when_goldfish_device(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     self.assertTrue(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          'example.com:123',
-          mock_properties={
-            'ro.build.id': 'AB42',
-            'ro.build.type': 'userdebug',
-            'ro.build.characteristics': 'emulator',
-          }))
+              return_value=mock_android_device.MockAdbProxy(
+                  'example.com:123',
+                  mock_properties={
+                      'ro.build.id': 'AB42',
+                      'ro.build.type': 'userdebug',
+                      'ro.build.characteristics': 'emulator',
+                  }))
   @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('example.com:123'))
+      'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+      return_value=mock_android_device.MockFastbootProxy('example.com:123'))
   def test_AndroidDevice_is_emulator_when_emulator_characteristic(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='example.com:123')
     self.assertTrue(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('emulator-5554'))
+              return_value=mock_android_device.MockAdbProxy('emulator-5554'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('emulator-5554'))
+      'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+      return_value=mock_android_device.MockFastbootProxy('emulator-5554'))
   def test_AndroidDevice_is_emulator_when_emulator_serial(
       self, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='emulator-5554')
     self.assertTrue(ad.is_emulator)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
-  def test_AndroidDevice_generate_filename_default(
-      self, get_log_file_timestamp_mock, MockFastboot, MockAdbProxy):
+  def test_AndroidDevice_generate_filename_default(self,
+                                                   get_log_file_timestamp_mock,
+                                                   MockFastboot, MockAdbProxy):
     mock_serial = 1
     ad = android_device.AndroidDevice(serial=mock_serial)
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     filename = ad.generate_filename('MagicLog')
-    self.assertEqual(filename,
-             'MagicLog,1,fakemodel,07-22-2019_17-53-34-450')
+    self.assertEqual(filename, 'MagicLog,1,fakemodel,07-22-2019_17-53-34-450')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
   @mock.patch('mobly.logger.sanitize_filename')
   def test_AndroidDevice_generate_filename_assert_sanitation(
-      self, sanitize_filename_mock, get_log_file_timestamp_mock,
-      MockFastboot, MockAdbProxy):
+      self, sanitize_filename_mock, get_log_file_timestamp_mock, MockFastboot,
+      MockAdbProxy):
     mock_serial = 1
     ad = android_device.AndroidDevice(serial=mock_serial)
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     filename = ad.generate_filename('MagicLog')
     sanitize_filename_mock.assert_called_with(
-      'MagicLog,1,fakemodel,07-22-2019_17-53-34-450')
+        'MagicLog,1,fakemodel,07-22-2019_17-53-34-450')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
-  def test_AndroidDevice_generate_filename_with_ext(
-      self, get_log_file_timestamp_mock, MockFastboot, MockAdbProxy):
+  def test_AndroidDevice_generate_filename_with_ext(self,
+                                                    get_log_file_timestamp_mock,
+                                                    MockFastboot, MockAdbProxy):
     mock_serial = 1
     ad = android_device.AndroidDevice(serial=mock_serial)
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     filename = ad.generate_filename('MagicLog', extension_name='log')
     self.assertEqual(filename,
-             'MagicLog,1,fakemodel,07-22-2019_17-53-34-450.log')
+                     'MagicLog,1,fakemodel,07-22-2019_17-53-34-450.log')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_generate_filename_with_debug_tag(
       self, get_log_file_timestamp_mock, MockFastboot, MockAdbProxy):
@@ -578,12 +574,12 @@
     ad.debug_tag = 'RoleX'
     filename = ad.generate_filename('MagicLog')
     self.assertEqual(filename,
-             'MagicLog,RoleX,1,fakemodel,07-22-2019_17-53-34-450')
+                     'MagicLog,RoleX,1,fakemodel,07-22-2019_17-53-34-450')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_generate_filename_with_runtime_info(
       self, get_log_file_timestamp_mock, MockFastboot, MockAdbProxy):
@@ -591,16 +587,15 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     mock_record = mock.MagicMock(begin_time='1234567')
-    mock_test_info = runtime_test_info.RuntimeTestInfo(
-      'test_xyz', '/tmp/blah/', mock_record)
-    filename = ad.generate_filename('MagicLog',
-                    time_identifier=mock_test_info)
+    mock_test_info = runtime_test_info.RuntimeTestInfo('test_xyz', '/tmp/blah/',
+                                                       mock_record)
+    filename = ad.generate_filename('MagicLog', time_identifier=mock_test_info)
     self.assertEqual(filename, 'MagicLog,1,fakemodel,test_xyz-1234567')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_generate_filename_with_custom_timestamp(
       self, get_log_file_timestamp_mock, MockFastboot, MockAdbProxy):
@@ -608,40 +603,38 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     filename = ad.generate_filename('MagicLog',
-                    time_identifier='my_special_time')
+                                    time_identifier='my_special_time')
     self.assertEqual(filename, 'MagicLog,1,fakemodel,my_special_time')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
-  def test_AndroidDevice_take_bug_report(self, create_dir_mock,
-                       FastbootProxy, MockAdbProxy):
+  def test_AndroidDevice_take_bug_report(self, create_dir_mock, FastbootProxy,
+                                         MockAdbProxy):
     """Verifies AndroidDevice.take_bug_report calls the correct adb command
     and writes the bugreport file to the correct path.
     """
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report(test_name='test_something',
-                     begin_time='sometime')
+                                     begin_time='sometime')
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path,
-             'bugreport,test_something,1,fakemodel,sometime.zip'))
+        output_path,
+        os.path.join(expected_path,
+                     'bugreport,test_something,1,fakemodel,sometime.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1',
-                                fail_br=True))
+              return_value=mock_android_device.MockAdbProxy('1', fail_br=True))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_fail(self, create_dir_mock,
-                        FastbootProxy, MockAdbProxy):
+                                              FastbootProxy, MockAdbProxy):
     """Verifies AndroidDevice.take_bug_report writes out the correct message
     when taking bugreport fails.
     """
@@ -649,13 +642,12 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     expected_msg = '.* Failed to take bugreport.'
     with self.assertRaisesRegex(android_device.Error, expected_msg):
-      ad.take_bug_report(test_name='test_something',
-                 begin_time='sometime')
+      ad.take_bug_report(test_name='test_something', begin_time='sometime')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_take_bug_report_without_args(
@@ -666,17 +658,16 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report()
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path,
-             'bugreport,1,fakemodel,07-22-2019_17-53-34-450.zip'))
+        output_path,
+        os.path.join(expected_path,
+                     'bugreport,1,fakemodel,07-22-2019_17-53-34-450.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_take_bug_report_with_only_test_name(
@@ -687,20 +678,18 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report(test_name='test_something')
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(
-        expected_path,
-        'bugreport,test_something,1,fakemodel,07-22-2019_17-53-34-450.zip'
-      ))
+        output_path,
+        os.path.join(
+            expected_path,
+            'bugreport,test_something,1,fakemodel,07-22-2019_17-53-34-450.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_with_only_begin_time(
       self, create_dir_mock, FastbootProxy, MockAdbProxy):
@@ -708,17 +697,16 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report(begin_time='sometime')
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path, 'bugreport,1,fakemodel,sometime.zip'))
+        output_path,
+        os.path.join(expected_path, 'bugreport,1,fakemodel,sometime.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_with_int_begin_time(
       self, create_dir_mock, FastbootProxy, MockAdbProxy):
@@ -726,17 +714,16 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report(begin_time=123)
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path, 'bugreport,1,fakemodel,123.zip'))
+        output_path, os.path.join(expected_path,
+                                  'bugreport,1,fakemodel,123.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_with_positional_args(
       self, create_dir_mock, FastbootProxy, MockAdbProxy):
@@ -744,18 +731,17 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report('test_something', 'sometime')
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path,
-             'bugreport,test_something,1,fakemodel,sometime.zip'))
+        output_path,
+        os.path.join(expected_path,
+                     'bugreport,test_something,1,fakemodel,sometime.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_with_destination(
       self, create_dir_mock, FastbootProxy, MockAdbProxy):
@@ -763,68 +749,64 @@
     ad = android_device.AndroidDevice(serial=mock_serial)
     dest = tempfile.gettempdir()
     output_path = ad.take_bug_report(test_name="test_something",
-                     begin_time="sometime",
-                     destination=dest)
+                                     begin_time="sometime",
+                                     destination=dest)
     expected_path = os.path.join(dest)
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path,
-             'bugreport,test_something,1,fakemodel,sometime.zip'))
+        output_path,
+        os.path.join(expected_path,
+                     'bugreport,test_something,1,fakemodel,sometime.zip'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(
-          '1', fail_br_before_N=True))
+              return_value=mock_android_device.MockAdbProxy(
+                  '1', fail_br_before_N=True))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   def test_AndroidDevice_take_bug_report_fallback(self, create_dir_mock,
-                          FastbootProxy,
-                          MockAdbProxy):
+                                                  FastbootProxy, MockAdbProxy):
     """Verifies AndroidDevice.take_bug_report falls back to traditional
     bugreport on builds that do not have bugreportz.
     """
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     output_path = ad.take_bug_report(test_name='test_something',
-                     begin_time='sometime')
+                                     begin_time='sometime')
     expected_path = os.path.join(logging.log_path,
-                   'AndroidDevice%s' % ad.serial,
-                   'BugReports')
+                                 'AndroidDevice%s' % ad.serial, 'BugReports')
     create_dir_mock.assert_called_with(expected_path)
     self.assertEqual(
-      output_path,
-      os.path.join(expected_path,
-             'bugreport,test_something,1,fakemodel,sometime.txt'))
+        output_path,
+        os.path.join(expected_path,
+                     'bugreport,test_something,1,fakemodel,sometime.txt'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
   @mock.patch('mobly.logger.get_log_file_timestamp')
   def test_AndroidDevice_take_screenshot(self, get_log_file_timestamp_mock,
-                       create_dir_mock, FastbootProxy,
-                       MockAdbProxy):
+                                         create_dir_mock, FastbootProxy,
+                                         MockAdbProxy):
     get_log_file_timestamp_mock.return_value = '07-22-2019_17-53-34-450'
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
     full_pic_path = ad.take_screenshot(self.tmp_dir)
     self.assertEqual(
-      full_pic_path,
-      os.path.join(self.tmp_dir,
-             'screenshot,1,fakemodel,07-22-2019_17-53-34-450.png'))
+        full_pic_path,
+        os.path.join(self.tmp_dir,
+                     'screenshot,1,fakemodel,07-22-2019_17-53-34-450.png'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
-  def test_AndroidDevice_change_log_path(self, stop_proc_mock,
-                       start_proc_mock, FastbootProxy,
-                       MockAdbProxy):
+  def test_AndroidDevice_change_log_path(self, stop_proc_mock, start_proc_mock,
+                                         FastbootProxy, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     old_path = ad.log_path
     new_log_path = tempfile.mkdtemp()
@@ -833,15 +815,15 @@
     self.assertFalse(os.path.exists(old_path))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
-  def test_AndroidDevice_change_log_path_no_log_exists(
-      self, stop_proc_mock, start_proc_mock, FastbootProxy,
-      MockAdbProxy):
+  def test_AndroidDevice_change_log_path_no_log_exists(self, stop_proc_mock,
+                                                       start_proc_mock,
+                                                       FastbootProxy,
+                                                       MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     old_path = ad.log_path
     new_log_path = tempfile.mkdtemp()
@@ -850,33 +832,29 @@
     self.assertFalse(os.path.exists(old_path))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('127.0.0.1:5557')
-        )
+              return_value=mock_android_device.MockAdbProxy('127.0.0.1:5557'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-    return_value=mock_android_device.MockFastbootProxy('127.0.0.1:5557'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+      'mobly.controllers.android_device_lib.fastboot.FastbootProxy',
+      return_value=mock_android_device.MockFastbootProxy('127.0.0.1:5557'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   def test_AndroidDevice_with_reserved_character_in_serial_log_path(
-      self, stop_proc_mock, start_proc_mock, FastbootProxy,
-      MockAdbProxy):
+      self, stop_proc_mock, start_proc_mock, FastbootProxy, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='127.0.0.1:5557')
     base_log_path = os.path.basename(ad.log_path)
     self.assertEqual(base_log_path, 'AndroidDevice127.0.0.1-5557')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_change_log_path_with_service(
-      self, open_logcat_mock, stop_proc_mock, start_proc_mock,
-      creat_dir_mock, FastbootProxy, MockAdbProxy):
+      self, open_logcat_mock, stop_proc_mock, start_proc_mock, creat_dir_mock,
+      FastbootProxy, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.services.logcat.start()
     new_log_path = tempfile.mkdtemp()
@@ -885,16 +863,15 @@
       ad.log_path = new_log_path
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   def test_AndroidDevice_change_log_path_with_existing_file(
-      self, stop_proc_mock, start_proc_mock, creat_dir_mock,
-      FastbootProxy, MockAdbProxy):
+      self, stop_proc_mock, start_proc_mock, creat_dir_mock, FastbootProxy,
+      MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     new_log_path = tempfile.mkdtemp()
     new_file_path = os.path.join(new_log_path, 'file.txt')
@@ -905,16 +882,15 @@
       ad.log_path = new_log_path
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   def test_AndroidDevice_update_serial(self, stop_proc_mock, start_proc_mock,
-                     creat_dir_mock, FastbootProxy,
-                     MockAdbProxy):
+                                       creat_dir_mock, FastbootProxy,
+                                       MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.update_serial('2')
     self.assertEqual(ad.serial, '2')
@@ -923,17 +899,16 @@
     self.assertEqual(ad.fastboot.serial, ad.serial)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch('mobly.utils.create_dir')
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_update_serial_with_service_running(
-      self, open_logcat_mock, stop_proc_mock, start_proc_mock,
-      creat_dir_mock, FastbootProxy, MockAdbProxy):
+      self, open_logcat_mock, stop_proc_mock, start_proc_mock, creat_dir_mock,
+      FastbootProxy, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.services.logcat.start()
     expected_msg = '.* Cannot change device serial number when there is service running.'
@@ -941,27 +916,27 @@
       ad.update_serial('2')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
   def test_AndroidDevice_load_snippet(self, MockGetPort, MockSnippetClient,
-                    MockFastboot, MockAdbProxy):
+                                      MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
     self.assertTrue(hasattr(ad, 'snippet'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
   def test_AndroidDevice_getattr(self, MockGetPort, MockSnippetClient,
-                   MockFastboot, MockAdbProxy):
+                                 MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
     value = {'value': 42}
@@ -969,65 +944,68 @@
     self.assertEqual(actual_value, value)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient',
-    return_value=MockSnippetClient)
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient',
+      return_value=MockSnippetClient)
   @mock.patch('mobly.utils.get_available_host_port')
   def test_AndroidDevice_load_snippet_dup_package(self, MockGetPort,
-                          MockSnippetClient,
-                          MockFastboot,
-                          MockAdbProxy):
+                                                  MockSnippetClient,
+                                                  MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
     expected_msg = ('Snippet package "%s" has already been loaded under '
-            'name "snippet".') % MOCK_SNIPPET_PACKAGE_NAME
+                    'name "snippet".') % MOCK_SNIPPET_PACKAGE_NAME
     with self.assertRaisesRegex(android_device.Error, expected_msg):
       ad.load_snippet('snippet2', MOCK_SNIPPET_PACKAGE_NAME)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient',
-    return_value=MockSnippetClient)
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient',
+      return_value=MockSnippetClient)
   @mock.patch('mobly.utils.get_available_host_port')
-  def test_AndroidDevice_load_snippet_dup_snippet_name(
-      self, MockGetPort, MockSnippetClient, MockFastboot, MockAdbProxy):
+  def test_AndroidDevice_load_snippet_dup_snippet_name(self, MockGetPort,
+                                                       MockSnippetClient,
+                                                       MockFastboot,
+                                                       MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
     expected_msg = ('.* Attribute "snippet" already exists, please use a '
-            'different name.')
+                    'different name.')
     with self.assertRaisesRegex(android_device.Error, expected_msg):
       ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME + 'haha')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
   def test_AndroidDevice_load_snippet_dup_attribute_name(
       self, MockGetPort, MockSnippetClient, MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     expected_msg = ('Attribute "%s" already exists, please use a different'
-            ' name') % 'adb'
+                    ' name') % 'adb'
     with self.assertRaisesRegex(android_device.Error, expected_msg):
       ad.load_snippet('adb', MOCK_SNIPPET_PACKAGE_NAME)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
-  def test_AndroidDevice_load_snippet_start_app_fails(
-      self, MockGetPort, MockSnippetClient, MockFastboot, MockAdbProxy):
+  def test_AndroidDevice_load_snippet_start_app_fails(self, MockGetPort,
+                                                      MockSnippetClient,
+                                                      MockFastboot,
+                                                      MockAdbProxy):
     """Verifies that the correct exception is raised if start app failed.
 
     It's possible that the `stop_app` call as part of the start app failure
@@ -1035,10 +1013,9 @@
     failure.
     """
     expected_e = Exception('start failed.')
-    MockSnippetClient.start_app_and_connect = mock.Mock(
-      side_effect=expected_e)
+    MockSnippetClient.start_app_and_connect = mock.Mock(side_effect=expected_e)
     MockSnippetClient.stop_app = mock.Mock(
-      side_effect=Exception('stop failed.'))
+        side_effect=Exception('stop failed.'))
     ad = android_device.AndroidDevice(serial='1')
     try:
       ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
@@ -1046,14 +1023,14 @@
       assertIs(e, expected_e)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
   def test_AndroidDevice_unload_snippet(self, MockGetPort, MockSnippetClient,
-                      MockFastboot, MockAdbProxy):
+                                        MockFastboot, MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
     ad.unload_snippet('snippet')
@@ -1067,16 +1044,16 @@
     self.assertTrue(hasattr(ad, 'snippet'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
+      'mobly.controllers.android_device_lib.snippet_client.SnippetClient')
   @mock.patch('mobly.utils.get_available_host_port')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_snippet_cleanup(self, open_logcat_mock, MockGetPort,
-                       MockSnippetClient, MockFastboot,
-                       MockAdbProxy):
+                                         MockSnippetClient, MockFastboot,
+                                         MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     ad.services.start_all()
     ad.load_snippet('snippet', MOCK_SNIPPET_PACKAGE_NAME)
@@ -1084,9 +1061,9 @@
     self.assertFalse(hasattr(ad, 'snippet'))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   def test_AndroidDevice_debug_tag(self, MockFastboot, MockAdbProxy):
     mock_serial = '1'
     ad = android_device.AndroidDevice(serial=mock_serial)
@@ -1108,18 +1085,18 @@
       self.assertEqual("(<AndroidDevice|Mememe>, 'Something')", str(e))
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_handle_usb_disconnect(self, open_logcat_mock,
-                         stop_proc_mock,
-                         start_proc_mock,
-                         FastbootProxy, MockAdbProxy):
+                                               stop_proc_mock, start_proc_mock,
+                                               FastbootProxy, MockAdbProxy):
+
     class MockService(base_service.BaseService):
+
       def __init__(self, device, configs=None):
         self._alive = False
         self.pause_called = False
@@ -1154,17 +1131,18 @@
     self.assertTrue(ad.services.mock_service.resume_called)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
-  def test_AndroidDevice_handle_reboot(self, open_logcat_mock,
-                     stop_proc_mock, start_proc_mock,
-                     FastbootProxy, MockAdbProxy):
+  def test_AndroidDevice_handle_reboot(self, open_logcat_mock, stop_proc_mock,
+                                       start_proc_mock, FastbootProxy,
+                                       MockAdbProxy):
+
     class MockService(base_service.BaseService):
+
       def __init__(self, device, configs=None):
         self._alive = False
         self.pause_called = False
@@ -1199,16 +1177,15 @@
     self.assertFalse(ad.services.mock_service.resume_called)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_handle_reboot_changes_build_info(
-      self, open_logcat_mock, stop_proc_mock, start_proc_mock,
-      FastbootProxy, MockAdbProxy):
+      self, open_logcat_mock, stop_proc_mock, start_proc_mock, FastbootProxy,
+      MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     with ad.handle_reboot():
       ad.adb.mock_properties['ro.build.type'] = 'user'
@@ -1219,16 +1196,15 @@
     self.assertEqual(ad.adb.getprops_call_count, 2)
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
-  @mock.patch('mobly.utils.start_standing_subprocess',
-        return_value='process')
+              return_value=mock_android_device.MockFastbootProxy('1'))
+  @mock.patch('mobly.utils.start_standing_subprocess', return_value='process')
   @mock.patch('mobly.utils.stop_standing_subprocess')
   @mock.patch.object(logcat.Logcat, '_open_logcat_file')
   def test_AndroidDevice_handle_reboot_changes_build_info_with_caching(
-      self, open_logcat_mock, stop_proc_mock, start_proc_mock,
-      FastbootProxy, MockAdbProxy):
+      self, open_logcat_mock, stop_proc_mock, start_proc_mock, FastbootProxy,
+      MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')  # Call getprops 1.
     rootable_states = [ad.is_rootable]
     with ad.handle_reboot():
@@ -1242,22 +1218,24 @@
     self.assertEqual(rootable_states, [True, True, False, False, False])
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device.AndroidDevice.is_boot_completed',
-    side_effect=[
-      False, False,
-      adb.AdbTimeoutError(['adb', 'shell', 'getprop sys.boot_completed'],
-                timeout=5,
-                serial=1), True
-    ])
+      'mobly.controllers.android_device.AndroidDevice.is_boot_completed',
+      side_effect=[
+          False, False,
+          adb.AdbTimeoutError(['adb', 'shell', 'getprop sys.boot_completed'],
+                              timeout=5,
+                              serial=1), True
+      ])
   @mock.patch('time.sleep', return_value=None)
   @mock.patch('time.time', side_effect=[0, 5, 10, 15, 20, 25, 30])
-  def test_AndroidDevice_wait_for_completion_completed(
-      self, MockTime, MockSleep, MockIsBootCompleted, FastbootProxy,
-      MockAdbProxy):
+  def test_AndroidDevice_wait_for_completion_completed(self, MockTime,
+                                                       MockSleep,
+                                                       MockIsBootCompleted,
+                                                       FastbootProxy,
+                                                       MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     raised = False
     try:
@@ -1265,27 +1243,28 @@
     except (adb.AdbError, adb.AdbTimeoutError):
       raised = True
     self.assertFalse(
-      raised,
-      'adb.AdbError or adb.AdbTimeoutError exception raised but not handled.'
-    )
+        raised,
+        'adb.AdbError or adb.AdbTimeoutError exception raised but not handled.')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy('1'))
+              return_value=mock_android_device.MockAdbProxy('1'))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy('1'))
+              return_value=mock_android_device.MockFastbootProxy('1'))
   @mock.patch(
-    'mobly.controllers.android_device.AndroidDevice.is_boot_completed',
-    side_effect=[
-      False, False,
-      adb.AdbTimeoutError(['adb', 'shell', 'getprop sys.boot_completed'],
-                timeout=5,
-                serial=1), False, False, False, False
-    ])
+      'mobly.controllers.android_device.AndroidDevice.is_boot_completed',
+      side_effect=[
+          False, False,
+          adb.AdbTimeoutError(['adb', 'shell', 'getprop sys.boot_completed'],
+                              timeout=5,
+                              serial=1), False, False, False, False
+      ])
   @mock.patch('time.sleep', return_value=None)
   @mock.patch('time.time', side_effect=[0, 5, 10, 15, 20, 25, 30])
-  def test_AndroidDevice_wait_for_completion_never_boot(
-      self, MockTime, MockSleep, MockIsBootCompleted, FastbootProxy,
-      MockAdbProxy):
+  def test_AndroidDevice_wait_for_completion_never_boot(self, MockTime,
+                                                        MockSleep,
+                                                        MockIsBootCompleted,
+                                                        FastbootProxy,
+                                                        MockAdbProxy):
     ad = android_device.AndroidDevice(serial='1')
     raised = False
     try:
@@ -1294,9 +1273,8 @@
     except (adb.AdbError, adb.AdbTimeoutError):
       raised = True
     self.assertFalse(
-      raised,
-      'adb.AdbError or adb.AdbTimeoutError exception raised but not handled.'
-    )
+        raised,
+        'adb.AdbError or adb.AdbTimeoutError exception raised but not handled.')
 
   def test_AndroidDevice_parse_device_list_when_decode_error(self):
     gbk_str = b'\xc4\xe3\xba\xc3'
@@ -1305,10 +1283,7 @@
       android_device.parse_device_list(gbk_str, 'some_key')
     except UnicodeDecodeError:
       raised = True
-    self.assertTrue(
-      raised,
-      'did not raise an exception when parsing gbk bytes'
-    )
+    self.assertTrue(raised, 'did not raise an exception when parsing gbk bytes')
 
 
 if __name__ == '__main__':
diff --git a/tests/mobly/controllers/monsoon_test.py b/tests/mobly/controllers/monsoon_test.py
index dd7c249..37b8150 100755
--- a/tests/mobly/controllers/monsoon_test.py
+++ b/tests/mobly/controllers/monsoon_test.py
@@ -18,8 +18,9 @@
 
 
 class MonsoonTest(unittest.TestCase):
+
   @unittest.skipIf(platform.system() == 'Windows',
-           'fcntl does not exist on Windows')
+                   'fcntl does not exist on Windows')
   def test_monsoon_import(self):
     # TODO: Replace 'fnctl' with a Windows equivalent when on Windows
     from mobly.controllers import monsoon
diff --git a/tests/mobly/logger_test.py b/tests/mobly/logger_test.py
index 9bedc0b..2eae65c 100755
--- a/tests/mobly/logger_test.py
+++ b/tests/mobly/logger_test.py
@@ -25,6 +25,7 @@
 class LoggerTest(unittest.TestCase):
   """Verifies code in mobly.logger module.
   """
+
   def setUp(self):
     self.log_dir = tempfile.mkdtemp()
 
@@ -33,20 +34,17 @@
 
   def test_epoch_to_log_line_timestamp(self):
     actual_stamp = logger.epoch_to_log_line_timestamp(1469134262116,
-                              time_zone=pytz.utc)
+                                                      time_zone=pytz.utc)
     self.assertEqual("07-21 20:51:02.116", actual_stamp)
 
   def test_is_valid_logline_timestamp(self):
-    self.assertTrue(
-      logger.is_valid_logline_timestamp("06-21 17:44:42.336"))
+    self.assertTrue(logger.is_valid_logline_timestamp("06-21 17:44:42.336"))
 
   def test_is_valid_logline_timestamp_when_wrong_length(self):
-    self.assertFalse(
-      logger.is_valid_logline_timestamp("  06-21 17:44:42.336"))
+    self.assertFalse(logger.is_valid_logline_timestamp("  06-21 17:44:42.336"))
 
   def test_is_valid_logline_timestamp_when_invalid_content(self):
-    self.assertFalse(
-      logger.is_valid_logline_timestamp("------------------"))
+    self.assertFalse(logger.is_valid_logline_timestamp("------------------"))
 
   @mock.patch('mobly.utils.create_alias')
   def test_create_latest_log_alias(self, mock_create_alias):
@@ -56,12 +54,12 @@
   @mock.patch('mobly.logger._setup_test_logger')
   @mock.patch('mobly.logger.create_latest_log_alias')
   def test_setup_test_logger_creates_log_alias(self,
-                         mock_create_latest_log_alias,
-                         mock__setup_test_logger):
+                                               mock_create_latest_log_alias,
+                                               mock__setup_test_logger):
     logger.setup_test_logger(self.log_dir)
     mock__setup_test_logger.assert_called_once_with(self.log_dir, None)
     mock_create_latest_log_alias.assert_called_once_with(self.log_dir,
-                               alias='latest')
+                                                         alias='latest')
 
   @mock.patch('mobly.logger._setup_test_logger')
   @mock.patch('mobly.logger.create_latest_log_alias')
@@ -71,155 +69,145 @@
     logger.setup_test_logger(self.log_dir, alias=mock_alias)
 
     mock_create_latest_log_alias.assert_called_once_with(self.log_dir,
-                               alias=mock_alias)
+                                                         alias=mock_alias)
 
   def test_sanitize_filename_when_valid(self):
     fake_filename = 'logcat.txt'
     expected_filename = 'logcat.txt'
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_valid_with_path(self):
     fake_filename = os.path.join('dir', 'logs', 'logcat.txt')
     expected_filename = os.path.join('dir', 'logs', 'logcat.txt')
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_random_spaces(self):
     fake_filename = 'log cat file.txt'
     expected_filename = 'log_cat_file.txt'
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_over_max_characters(self):
     fake_filename = 'l' * 300
     expected_filename = 'l' * 237
     self.assertEqual(len(logger.sanitize_filename(fake_filename)), 237)
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_over_max_characters_with_extension(self):
     fake_filename = 'l' * 300 + '.txt'
     expected_filename = 'l' * 233 + '.txt'
     self.assertEqual(len(logger.sanitize_filename(fake_filename)), 237)
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_extension_at_max_characters(self):
     fake_filename = 'l' * 300 + '.' + 't' * 236
     expected_filename = '.' + 't' * 236
     self.assertEqual(len(logger.sanitize_filename(fake_filename)), 237)
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_extension_over_max_characters(self):
     fake_filename = 'l' * 300 + '.' + 't' * 300
     expected_filename = 'l' * 237
     self.assertEqual(len(logger.sanitize_filename(fake_filename)), 237)
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test__sanitize_windows_filename_when_path_characters(self):
     fake_filename = '/\\'
     expected_filename = '__'
     self.assertEqual(logger._sanitize_windows_filename(fake_filename),
-             expected_filename)
+                     expected_filename)
 
   def test_sanitize_filename_when_specical_characters(self):
     fake_filename = '<>:"|?*\x00'
     expected_filename = '---_,,,0'
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_con(self):
     for fake_filename, expected_filename in [
-      ('con', 'mobly_con'),
-      ('CON', 'mobly_CON'),
-      ('con.txt', 'mobly_con.txt'),
-      ('connections.log', 'connections.log'),
+        ('con', 'mobly_con'),
+        ('CON', 'mobly_CON'),
+        ('con.txt', 'mobly_con.txt'),
+        ('connections.log', 'connections.log'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_prn(self):
     for fake_filename, expected_filename in [
-      ('prn', 'mobly_prn'),
-      ('PRN', 'mobly_PRN'),
-      ('prn.txt', 'mobly_prn.txt'),
-      ('prnters.log', 'prnters.log'),
+        ('prn', 'mobly_prn'),
+        ('PRN', 'mobly_PRN'),
+        ('prn.txt', 'mobly_prn.txt'),
+        ('prnters.log', 'prnters.log'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_aux(self):
     for fake_filename, expected_filename in [
-      ('aux', 'mobly_aux'),
-      ('AUX', 'mobly_AUX'),
-      ('aux.txt', 'mobly_aux.txt'),
-      ('auxiliaries.log', 'auxiliaries.log'),
+        ('aux', 'mobly_aux'),
+        ('AUX', 'mobly_AUX'),
+        ('aux.txt', 'mobly_aux.txt'),
+        ('auxiliaries.log', 'auxiliaries.log'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_nul(self):
     for fake_filename, expected_filename in [
-      ('nul', 'mobly_nul'),
-      ('NUL', 'mobly_NUL'),
-      ('nul.txt', 'mobly_nul.txt'),
-      ('nullptrs.log', 'nullptrs.log'),
+        ('nul', 'mobly_nul'),
+        ('NUL', 'mobly_NUL'),
+        ('nul.txt', 'mobly_nul.txt'),
+        ('nullptrs.log', 'nullptrs.log'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_com(self):
     for fake_filename, expected_filename in [
-      ('com', 'com'),
-      ('COM0', 'mobly_COM0'),
-      ('com1', 'mobly_com1'),
-      ('COM2', 'mobly_COM2'),
-      ('com3', 'mobly_com3'),
-      ('COM4', 'mobly_COM4'),
-      ('com5', 'mobly_com5'),
-      ('COM6', 'mobly_COM6'),
-      ('com7', 'mobly_com7'),
-      ('COM8', 'mobly_COM8'),
-      ('com9', 'mobly_com9'),
-      ('com0.log', 'mobly_com0.log'),
-      ('com0files.log', 'com0files.log'),
+        ('com', 'com'),
+        ('COM0', 'mobly_COM0'),
+        ('com1', 'mobly_com1'),
+        ('COM2', 'mobly_COM2'),
+        ('com3', 'mobly_com3'),
+        ('COM4', 'mobly_COM4'),
+        ('com5', 'mobly_com5'),
+        ('COM6', 'mobly_COM6'),
+        ('com7', 'mobly_com7'),
+        ('COM8', 'mobly_COM8'),
+        ('com9', 'mobly_com9'),
+        ('com0.log', 'mobly_com0.log'),
+        ('com0files.log', 'com0files.log'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_lpt(self):
     for fake_filename, expected_filename in [
-      ('lpt', 'lpt'),
-      ('LPT0', 'mobly_LPT0'),
-      ('lpt1', 'mobly_lpt1'),
-      ('LPT2', 'mobly_LPT2'),
-      ('lpt3', 'mobly_lpt3'),
-      ('LPT4', 'mobly_LPT4'),
-      ('lpt5', 'mobly_lpt5'),
-      ('LPT6', 'mobly_LPT6'),
-      ('lpt7', 'mobly_lpt7'),
-      ('LPT8', 'mobly_LPT8'),
-      ('lpt9', 'mobly_lpt9'),
-      ('lpt3.txt', 'mobly_lpt3.txt'),
-      ('lpt3_file.txt', 'lpt3_file.txt'),
+        ('lpt', 'lpt'),
+        ('LPT0', 'mobly_LPT0'),
+        ('lpt1', 'mobly_lpt1'),
+        ('LPT2', 'mobly_LPT2'),
+        ('lpt3', 'mobly_lpt3'),
+        ('LPT4', 'mobly_LPT4'),
+        ('lpt5', 'mobly_lpt5'),
+        ('LPT6', 'mobly_LPT6'),
+        ('lpt7', 'mobly_lpt7'),
+        ('LPT8', 'mobly_LPT8'),
+        ('lpt9', 'mobly_lpt9'),
+        ('lpt3.txt', 'mobly_lpt3.txt'),
+        ('lpt3_file.txt', 'lpt3_file.txt'),
     ]:
       self.assertEqual(logger.sanitize_filename(fake_filename),
-               expected_filename)
+                       expected_filename)
 
   def test_sanitize_filename_when_ends_with_space(self):
     fake_filename = 'logcat.txt '
     expected_filename = 'logcat.txt_'
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
   def test_sanitize_filename_when_ends_with_period(self):
     fake_filename = 'logcat.txt.'
     expected_filename = 'logcat.txt_'
-    self.assertEqual(logger.sanitize_filename(fake_filename),
-             expected_filename)
+    self.assertEqual(logger.sanitize_filename(fake_filename), expected_filename)
 
 
 if __name__ == "__main__":
diff --git a/tests/mobly/output_test.py b/tests/mobly/output_test.py
index 676d7fc..aca8f14 100755
--- a/tests/mobly/output_test.py
+++ b/tests/mobly/output_test.py
@@ -47,8 +47,8 @@
     self.base_mock_test_config.testbed_name = 'SampleTestBed'
     self.base_mock_test_config.controller_configs = {}
     self.base_mock_test_config.user_params = {
-      'icecream': 42,
-      'extra_param': 'haha'
+        'icecream': 42,
+        'extra_param': 'haha'
     }
     self.base_mock_test_config.log_path = self.tmp_dir
     self.log_dir = self.base_mock_test_config.log_path
@@ -61,20 +61,18 @@
     mock_test_config = base_mock_test_config.copy()
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{
-      'serial': 'xxxx',
-      'magic': 'Magic1'
+        'serial': 'xxxx',
+        'magic': 'Magic1'
     }, {
-      'serial': 'xxxx',
-      'magic': 'Magic2'
+        'serial': 'xxxx',
+        'magic': 'Magic2'
     }]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
     return mock_test_config
 
   def get_output_logs(self, output_dir):
-    summary_file_path = os.path.join(output_dir,
-                     records.OUTPUT_FILE_SUMMARY)
-    debug_log_path = os.path.join(output_dir,
-                    records.OUTPUT_FILE_DEBUG_LOG)
+    summary_file_path = os.path.join(output_dir, records.OUTPUT_FILE_SUMMARY)
+    debug_log_path = os.path.join(output_dir, records.OUTPUT_FILE_DEBUG_LOG)
     info_log_path = os.path.join(output_dir, records.OUTPUT_FILE_INFO_LOG)
     return (summary_file_path, debug_log_path, info_log_path)
 
@@ -100,11 +98,10 @@
       self.assertEqual(log_path, logging.log_path)
 
   @unittest.skipIf(platform.system() == 'Windows',
-           'Symlinks are usually specific to Unix operating systems')
+                   'Symlinks are usually specific to Unix operating systems')
   def test_symlink(self):
     """Verifies the symlink is created and links properly."""
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
       pass
@@ -112,58 +109,50 @@
     self.assertEqual(os.readlink(symlink), logging.log_path)
 
   @unittest.skipIf(platform.system() != 'Windows',
-           'Shortcuts are specific to Windows operating systems')
+                   'Shortcuts are specific to Windows operating systems')
   def test_shortcut(self):
     """Verifies the shortcut is created and links properly."""
-    shortcut_path = os.path.join(self.log_dir, self.testbed_name,
-                   'latest.lnk')
+    shortcut_path = os.path.join(self.log_dir, self.testbed_name, 'latest.lnk')
     shell = client.Dispatch("WScript.Shell")
     shortcut = shell.CreateShortCut(shortcut_path)
     self.assertFalse(shortcut.Targetpath)
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
       pass
     shortcut = shell.CreateShortCut(shortcut_path)
     # Normalize paths for case and truncation
     normalized_shortcut_path = os.path.normcase(
-      win32file.GetLongPathName(shortcut.Targetpath))
+        win32file.GetLongPathName(shortcut.Targetpath))
     normalized_logger_path = os.path.normcase(
-      win32file.GetLongPathName(logging.log_path))
+        win32file.GetLongPathName(logging.log_path))
     self.assertEqual(normalized_shortcut_path, normalized_logger_path)
 
   @mock.patch('mobly.utils.create_alias')
-  def test_mobly_logger_with_default_latest_log_alias(
-      self, mock_create_alias):
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+  def test_mobly_logger_with_default_latest_log_alias(self, mock_create_alias):
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
       pass
-    expected_alias_dir = os.path.join(self.log_dir, self.testbed_name,
-                      'latest')
+    expected_alias_dir = os.path.join(self.log_dir, self.testbed_name, 'latest')
     mock_create_alias.assert_called_once_with(logging.log_path,
-                          expected_alias_dir)
+                                              expected_alias_dir)
 
   @mock.patch('mobly.utils.create_alias')
-  def test_mobly_logger_with_custom_latest_log_alias(self,
-                             mock_create_alias):
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+  def test_mobly_logger_with_custom_latest_log_alias(self, mock_create_alias):
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger(alias='history'):
       pass
     expected_alias_dir = os.path.join(self.log_dir, self.testbed_name,
-                      'history')
+                                      'history')
     mock_create_alias.assert_called_once_with(logging.log_path,
-                          expected_alias_dir)
+                                              expected_alias_dir)
 
   @mock.patch('mobly.utils.create_alias')
   def test_mobly_logger_skips_latest_log_alias_when_none(
       self, mock_create_alias):
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger(alias=None):
       pass
@@ -172,8 +161,7 @@
   @mock.patch('mobly.utils.create_alias')
   def test_mobly_logger_skips_latest_log_alias_when_empty(
       self, mock_create_alias):
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger(alias=''):
       pass
@@ -185,36 +173,32 @@
     * Files are correctly created.
     * Basic sanity checks of each output file.
     """
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     info_uuid = 'e098d4ff-4e90-4e08-b369-aa84a7ef90ec'
     debug_uuid = 'c6f1474e-960a-4df8-8305-1c5b8b905eca'
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
       logging.info(info_uuid)
       logging.debug(debug_uuid)
-      tr.add_test_class(mock_test_config,
-                integration_test.IntegrationTest)
+      tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
       tr.run()
     output_dir = logging.root_output_path
     (summary_file_path, debug_log_path,
      info_log_path) = self.assert_output_logs_exist(output_dir)
-    self.assert_log_contents(debug_log_path,
-                 whitelist=[debug_uuid, info_uuid])
+    self.assert_log_contents(debug_log_path, whitelist=[debug_uuid, info_uuid])
     self.assert_log_contents(info_log_path,
-                 whitelist=[info_uuid],
-                 blacklist=[debug_uuid])
+                             whitelist=[info_uuid],
+                             blacklist=[debug_uuid])
 
   @mock.patch('mobly.logger.get_log_file_timestamp',
-        side_effect=str(time.time()))
+              side_effect=str(time.time()))
   def test_run_twice_for_two_sets_of_logs(self, mock_timestamp):
     """Verifies the expected output files from a test run.
 
     * Files are correctly created.
     * Basic sanity checks of each output file.
     """
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
     with tr.mobly_logger():
@@ -228,15 +212,14 @@
     self.assert_output_logs_exist(output_dir2)
 
   @mock.patch('mobly.logger.get_log_file_timestamp',
-        side_effect=str(time.time()))
+              side_effect=str(time.time()))
   def test_teardown_erases_logs(self, mock_timestamp):
     """Verifies the expected output files from a test run.
 
     * Files are correctly created.
     * Basic sanity checks of each output file.
     """
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     info_uuid1 = '0c3ebb06-700d-496e-b015-62652da9e451'
     debug_uuid1 = '0c3ebb06-700d-496e-b015-62652da9e451'
     info_uuid2 = '484ef7db-f2dd-4b76-a126-c2f263e3808c'
@@ -261,11 +244,11 @@
      info_log_path2) = self.get_output_logs(output_dir2)
 
     self.assert_log_contents(debug_log_path1,
-                 whitelist=[debug_uuid1, info_uuid1],
-                 blacklist=[info_uuid2, debug_uuid2])
+                             whitelist=[debug_uuid1, info_uuid1],
+                             blacklist=[info_uuid2, debug_uuid2])
     self.assert_log_contents(debug_log_path2,
-                 whitelist=[debug_uuid2, info_uuid2],
-                 blacklist=[info_uuid1, debug_uuid1])
+                             whitelist=[debug_uuid2, info_uuid2],
+                             blacklist=[info_uuid1, debug_uuid1])
 
   def test_basic_output(self):
     """Verifies the expected output files from a test run.
@@ -273,15 +256,13 @@
     * Files are correctly created.
     * Basic sanity checks of each output file.
     """
-    mock_test_config = self.create_mock_test_config(
-      self.base_mock_test_config)
+    mock_test_config = self.create_mock_test_config(self.base_mock_test_config)
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(mock_test_config,
-                integration_test.IntegrationTest)
+      tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
       tr.run()
     expected_class_path = os.path.join(logging.root_output_path,
-                       'IntegrationTest')
+                                       'IntegrationTest')
     self.assertEqual(expected_class_path, logging.log_path)
     os.path.exists(logging.log_path)
     output_dir = logging.root_output_path
@@ -294,8 +275,8 @@
         summary_entries.append(entry)
     self.assert_log_contents(debug_log_path, whitelist=['DEBUG', 'INFO'])
     self.assert_log_contents(info_log_path,
-                 whitelist=['INFO'],
-                 blacklist=['DEBUG'])
+                             whitelist=['INFO'],
+                             blacklist=['DEBUG'])
 
   def test_teardown_class_output(self):
     """Verifies the summary file includes the failure record for
@@ -304,27 +285,23 @@
     mock_test_config = self.base_mock_test_config.copy()
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(
-        mock_test_config,
-        teardown_class_failure_test.TearDownClassFailureTest)
+      tr.add_test_class(mock_test_config,
+                        teardown_class_failure_test.TearDownClassFailureTest)
       tr.run()
     output_dir = logging.root_output_path
-    summary_file_path = os.path.join(output_dir,
-                     records.OUTPUT_FILE_SUMMARY)
+    summary_file_path = os.path.join(output_dir, records.OUTPUT_FILE_SUMMARY)
     found = False
     with io.open(summary_file_path, 'r', encoding='utf-8') as f:
       raw_content = f.read()
       f.seek(0)
       for entry in yaml.safe_load_all(f):
-        if (entry['Type'] == 'Record'
-            and entry[records.TestResultEnums.RECORD_NAME] ==
-            'teardown_class'):
+        if (entry['Type'] == 'Record' and
+            entry[records.TestResultEnums.RECORD_NAME] == 'teardown_class'):
           found = True
           break
       self.assertTrue(
-        found,
-        'No record for teardown_class found in the output file:\n %s' %
-        raw_content)
+          found, 'No record for teardown_class found in the output file:\n %s' %
+          raw_content)
 
 
 if __name__ == "__main__":
diff --git a/tests/mobly/records_test.py b/tests/mobly/records_test.py
index d850675..404337e 100755
--- a/tests/mobly/records_test.py
+++ b/tests/mobly/records_test.py
@@ -83,8 +83,7 @@
     # in them.
     if stacktrace:
       stacktrace_key = records.TestResultEnums.RECORD_STACKTRACE
-      self.assertTrue(
-        d.pop(stacktrace_key) in actual_d.pop(stacktrace_key))
+      self.assertTrue(d.pop(stacktrace_key) in actual_d.pop(stacktrace_key))
     self.assertDictEqual(actual_d, d)
     # Verify that these code paths do not cause crashes and yield non-empty
     # results.
@@ -97,43 +96,39 @@
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     record.test_pass()
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_PASS,
-      details=None,
-      extras=None)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_PASS,
+                       details=None,
+                       extras=None)
 
   def test_result_record_pass_with_float_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestPass(self.details, self.float_extra)
     record.test_pass(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_PASS,
-      details=self.details,
-      extras=self.float_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_PASS,
+                       details=self.details,
+                       extras=self.float_extra)
 
   def test_result_record_pass_with_json_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestPass(self.details, self.json_extra)
     record.test_pass(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_PASS,
-      details=self.details,
-      extras=self.json_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_PASS,
+                       details=self.details,
+                       extras=self.json_extra)
 
   def test_result_record_fail_none(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     record.test_fail()
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details=None,
-      extras=None)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details=None,
+                       extras=None)
 
   def test_result_record_fail_stacktrace(self):
     record = records.TestResultRecord(self.tn)
@@ -145,25 +140,23 @@
     # Verify stacktrace separately if we expect a non-None value.
     # Because stacktrace includes file names and line numbers, we can't do
     # a simple equality check.
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details='Something failed.',
-      extras=None,
-      stacktrace='in test_result_record_fail_stacktrace\n    '
-      'raise Exception(\'Something failed.\')\nException: '
-      'Something failed.\n')
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details='Something failed.',
+                       extras=None,
+                       stacktrace='in test_result_record_fail_stacktrace\n    '
+                       'raise Exception(\'Something failed.\')\nException: '
+                       'Something failed.\n')
 
   def test_result_record_fail_with_float_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestFailure(self.details, self.float_extra)
     record.test_fail(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details=self.details,
-      extras=self.float_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details=self.details,
+                       extras=self.float_extra)
 
   def test_result_record_fail_with_unicode_test_signal(self):
     record = records.TestResultRecord(self.tn)
@@ -171,11 +164,10 @@
     details = u'\u2022'
     s = signals.TestFailure(details, self.float_extra)
     record.test_fail(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details=details,
-      extras=self.float_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details=details,
+                       extras=self.float_extra)
 
   def test_result_record_fail_with_unicode_exception(self):
     record = records.TestResultRecord(self.tn)
@@ -183,54 +175,49 @@
     details = u'\u2022'
     s = Exception(details)
     record.test_fail(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details=details,
-      extras=None)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details=details,
+                       extras=None)
 
   def test_result_record_fail_with_json_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestFailure(self.details, self.json_extra)
     record.test_fail(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_FAIL,
-      details=self.details,
-      extras=self.json_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_FAIL,
+                       details=self.details,
+                       extras=self.json_extra)
 
   def test_result_record_skip_none(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     record.test_skip()
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_SKIP,
-      details=None,
-      extras=None)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_SKIP,
+                       details=None,
+                       extras=None)
 
   def test_result_record_skip_with_float_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestSkip(self.details, self.float_extra)
     record.test_skip(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_SKIP,
-      details=self.details,
-      extras=self.float_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_SKIP,
+                       details=self.details,
+                       extras=self.float_extra)
 
   def test_result_record_skip_with_json_extra(self):
     record = records.TestResultRecord(self.tn)
     record.test_begin()
     s = signals.TestSkip(self.details, self.json_extra)
     record.test_skip(s)
-    self.verify_record(
-      record=record,
-      result=records.TestResultEnums.TEST_RESULT_SKIP,
-      details=self.details,
-      extras=self.json_extra)
+    self.verify_record(record=record,
+                       result=records.TestResultEnums.TEST_RESULT_SKIP,
+                       details=self.details,
+                       extras=self.json_extra)
 
   def test_result_add_operator_success(self):
     record1 = records.TestResultRecord(self.tn)
@@ -239,8 +226,8 @@
     record1.test_pass(s)
     tr1 = records.TestResult()
     tr1.add_record(record1)
-    controller_info = records.ControllerInfoRecord(
-      'SomeClass', 'MockDevice', ['magicA', 'magicB'])
+    controller_info = records.ControllerInfoRecord('SomeClass', 'MockDevice',
+                                                   ['magicA', 'magicB'])
     tr1.add_controller_info_record(controller_info)
     record2 = records.TestResultRecord(self.tn)
     record2.test_begin()
@@ -248,8 +235,8 @@
     record2.test_pass(s)
     tr2 = records.TestResult()
     tr2.add_record(record2)
-    controller_info = records.ControllerInfoRecord(
-      'SomeClass', 'MockDevice', ['magicC'])
+    controller_info = records.ControllerInfoRecord('SomeClass', 'MockDevice',
+                                                   ['magicC'])
     tr2.add_controller_info_record(controller_info)
     tr2 += tr1
     self.assertTrue(tr2.passed, [tr1, tr2])
@@ -292,6 +279,7 @@
     tr.add_record(record1)
 
     class SpecialError(Exception):
+
       def __init__(self, arg1, arg2):
         self.msg = '%s %s' % (arg1, arg2)
 
@@ -363,11 +351,11 @@
     with io.open(dump_path, 'r', encoding='utf-8') as f:
       content = yaml.safe_load(f)
       self.assertEqual(content['Type'],
-               records.TestSummaryEntryType.RECORD.value)
+                       records.TestSummaryEntryType.RECORD.value)
       self.assertEqual(content[records.TestResultEnums.RECORD_DETAILS],
-               self.details)
+                       self.details)
       self.assertEqual(content[records.TestResultEnums.RECORD_EXTRAS],
-               self.float_extra)
+                       self.float_extra)
 
   def test_summary_write_dump_with_unicode(self):
     unicode_details = u'\u901a'  # utf-8 -> b'\xe9\x80\x9a'
@@ -382,11 +370,11 @@
     with io.open(dump_path, 'r', encoding='utf-8') as f:
       content = yaml.safe_load(f)
       self.assertEqual(content['Type'],
-               records.TestSummaryEntryType.RECORD.value)
+                       records.TestSummaryEntryType.RECORD.value)
       self.assertEqual(content[records.TestResultEnums.RECORD_DETAILS],
-               unicode_details)
+                       unicode_details)
       self.assertEqual(content[records.TestResultEnums.RECORD_EXTRAS],
-               unicode_extras)
+                       unicode_extras)
 
   def test_summary_user_data(self):
     user_data1 = {'a': 1}
@@ -402,7 +390,7 @@
         contents.append(c)
     for content in contents:
       self.assertEqual(content['Type'],
-               records.TestSummaryEntryType.USER_DATA.value)
+                       records.TestSummaryEntryType.USER_DATA.value)
     self.assertEqual(contents[0]['a'], user_data1['a'])
     self.assertEqual(contents[1]['b'], user_data2['b'])
 
@@ -419,15 +407,16 @@
   def test_add_controller_info_record(self):
     tr = records.TestResult()
     self.assertFalse(tr.controller_info)
-    controller_info = records.ControllerInfoRecord(
-      'SomeClass', 'MockDevice', ['magicA', 'magicB'])
+    controller_info = records.ControllerInfoRecord('SomeClass', 'MockDevice',
+                                                   ['magicA', 'magicB'])
     tr.add_controller_info_record(controller_info)
     self.assertTrue(tr.controller_info[0])
     self.assertEqual(tr.controller_info[0].controller_name, 'MockDevice')
     self.assertEqual(tr.controller_info[0].controller_info,
-             ['magicA', 'magicB'])
+                     ['magicA', 'magicB'])
 
   def test_uid(self):
+
     @records.uid('some-uuid')
     def test_uid_helper():
       """Dummy test used by `test_uid` for testing the uid decorator."""
diff --git a/tests/mobly/suite_runner_test.py b/tests/mobly/suite_runner_test.py
index f9665fb..30b190a 100755
--- a/tests/mobly/suite_runner_test.py
+++ b/tests/mobly/suite_runner_test.py
@@ -26,6 +26,7 @@
 
 
 class SuiteRunnerTest(unittest.TestCase):
+
   def setUp(self):
     self.tmp_dir = tempfile.mkdtemp()
 
@@ -34,53 +35,45 @@
 
   def test_select_no_args(self):
     identifiers = suite_runner.compute_selected_tests(test_classes=[
-      integration_test.IntegrationTest,
-      integration2_test.Integration2Test
+        integration_test.IntegrationTest, integration2_test.Integration2Test
     ],
-                              selected_tests=None)
+                                                      selected_tests=None)
     self.assertEqual(
-      {
-        integration_test.IntegrationTest: None,
-        integration2_test.Integration2Test: None,
-      }, identifiers)
+        {
+            integration_test.IntegrationTest: None,
+            integration2_test.Integration2Test: None,
+        }, identifiers)
 
   def test_select_by_class(self):
     identifiers = suite_runner.compute_selected_tests(
-      test_classes=[
-        integration_test.IntegrationTest,
-        integration2_test.Integration2Test
-      ],
-      selected_tests=['IntegrationTest'])
+        test_classes=[
+            integration_test.IntegrationTest, integration2_test.Integration2Test
+        ],
+        selected_tests=['IntegrationTest'])
     self.assertEqual({integration_test.IntegrationTest: None}, identifiers)
 
   def test_select_by_method(self):
     identifiers = suite_runner.compute_selected_tests(
-      test_classes=[
-        integration_test.IntegrationTest,
-        integration2_test.Integration2Test
-      ],
-      selected_tests=[
-        'IntegrationTest.test_a', 'IntegrationTest.test_b'
-      ])
-    self.assertEqual(
-      {integration_test.IntegrationTest: ['test_a', 'test_b']},
-      identifiers)
+        test_classes=[
+            integration_test.IntegrationTest, integration2_test.Integration2Test
+        ],
+        selected_tests=['IntegrationTest.test_a', 'IntegrationTest.test_b'])
+    self.assertEqual({integration_test.IntegrationTest: ['test_a', 'test_b']},
+                     identifiers)
 
   def test_select_all_clobbers_method(self):
     identifiers = suite_runner.compute_selected_tests(
-      test_classes=[
-        integration_test.IntegrationTest,
-        integration2_test.Integration2Test
-      ],
-      selected_tests=['IntegrationTest.test_a', 'IntegrationTest'])
+        test_classes=[
+            integration_test.IntegrationTest, integration2_test.Integration2Test
+        ],
+        selected_tests=['IntegrationTest.test_a', 'IntegrationTest'])
     self.assertEqual({integration_test.IntegrationTest: None}, identifiers)
 
     identifiers = suite_runner.compute_selected_tests(
-      test_classes=[
-        integration_test.IntegrationTest,
-        integration2_test.Integration2Test
-      ],
-      selected_tests=['IntegrationTest', 'IntegrationTest.test_a'])
+        test_classes=[
+            integration_test.IntegrationTest, integration2_test.Integration2Test
+        ],
+        selected_tests=['IntegrationTest', 'IntegrationTest.test_a'])
     self.assertEqual({integration_test.IntegrationTest: None}, identifiers)
 
   @mock.patch('sys.exit')
@@ -98,7 +91,7 @@
               extra_param: 'haha'
       """)
     suite_runner.run_suite([integration_test.IntegrationTest],
-                 argv=['-c', tmp_file_path])
+                           argv=['-c', tmp_file_path])
     mock_exit.assert_not_called()
 
   @mock.patch('sys.exit')
@@ -113,7 +106,7 @@
               MagicDevice: '*'
       """)
     suite_runner.run_suite([integration_test.IntegrationTest],
-                 argv=['-c', tmp_file_path])
+                           argv=['-c', tmp_file_path])
     mock_exit.assert_called_once_with(1)
 
 
diff --git a/tests/mobly/test_runner_test.py b/tests/mobly/test_runner_test.py
index 6077675..72f0d97 100755
--- a/tests/mobly/test_runner_test.py
+++ b/tests/mobly/test_runner_test.py
@@ -46,8 +46,8 @@
     self.base_mock_test_config.testbed_name = 'SampleTestBed'
     self.base_mock_test_config.controller_configs = {}
     self.base_mock_test_config.user_params = {
-      'icecream': 42,
-      'extra_param': 'haha'
+        'icecream': 42,
+        'extra_param': 'haha'
     }
     self.base_mock_test_config.log_path = self.tmp_dir
     self.log_dir = self.base_mock_test_config.log_path
@@ -58,10 +58,10 @@
 
   def _assertControllerInfoEqual(self, info, expected_info_dict):
     self.assertEqual(expected_info_dict['Controller Name'],
-             info.controller_name)
+                     info.controller_name)
     self.assertEqual(expected_info_dict['Test Class'], info.test_class)
     self.assertEqual(expected_info_dict['Controller Info'],
-             info.controller_info)
+                     info.controller_info)
 
   def test_run_twice(self):
     """Verifies that:
@@ -72,20 +72,19 @@
     mock_test_config = self.base_mock_test_config.copy()
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{
-      'serial': 'xxxx',
-      'magic': 'Magic1'
+        'serial': 'xxxx',
+        'magic': 'Magic1'
     }, {
-      'serial': 'xxxx',
-      'magic': 'Magic2'
+        'serial': 'xxxx',
+        'magic': 'Magic2'
     }]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(mock_test_config,
-                integration_test.IntegrationTest)
+      tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
       tr.run()
     self.assertTrue(
-      mock_test_config.controller_configs[mock_ctrlr_config_name][0])
+        mock_test_config.controller_configs[mock_ctrlr_config_name][0])
     with tr.mobly_logger():
       tr.run()
     results = tr.results.summary_dict()
@@ -93,26 +92,24 @@
     self.assertEqual(results['Executed'], 2)
     self.assertEqual(results['Passed'], 2)
     expected_info_dict = {
-      'Controller Info': [{
-        'MyMagic': {
-          'magic': 'Magic1'
-        }
-      }, {
-        'MyMagic': {
-          'magic': 'Magic2'
-        }
-      }],
-      'Controller Name':
-      'MagicDevice',
-      'Test Class':
-      'IntegrationTest',
+        'Controller Info': [{
+            'MyMagic': {
+                'magic': 'Magic1'
+            }
+        }, {
+            'MyMagic': {
+                'magic': 'Magic2'
+            }
+        }],
+        'Controller Name': 'MagicDevice',
+        'Test Class': 'IntegrationTest',
     }
     self._assertControllerInfoEqual(tr.results.controller_info[0],
-                    expected_info_dict)
+                                    expected_info_dict)
     self._assertControllerInfoEqual(tr.results.controller_info[1],
-                    expected_info_dict)
+                                    expected_info_dict)
     self.assertNotEqual(tr.results.controller_info[0],
-              tr.results.controller_info[1])
+                        tr.results.controller_info[1])
 
   def test_summary_file_entries(self):
     """Verifies the output summary's file format.
@@ -123,40 +120,39 @@
     mock_test_config = self.base_mock_test_config.copy()
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{
-      'serial': 'xxxx',
-      'magic': 'Magic1'
+        'serial': 'xxxx',
+        'magic': 'Magic1'
     }, {
-      'serial': 'xxxx',
-      'magic': 'Magic2'
+        'serial': 'xxxx',
+        'magic': 'Magic2'
     }]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(mock_test_config,
-                integration_test.IntegrationTest)
+      tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
       tr.run()
     summary_path = os.path.join(logging.root_output_path,
-                  records.OUTPUT_FILE_SUMMARY)
+                                records.OUTPUT_FILE_SUMMARY)
     with io.open(summary_path, 'r', encoding='utf-8') as f:
       summary_entries = list(yaml.safe_load_all(f))
     self.assertEqual(len(summary_entries), 4)
     # Verify the first entry is the list of test names.
     self.assertEqual(summary_entries[0]['Type'],
-             records.TestSummaryEntryType.TEST_NAME_LIST.value)
+                     records.TestSummaryEntryType.TEST_NAME_LIST.value)
     self.assertEqual(summary_entries[1]['Type'],
-             records.TestSummaryEntryType.RECORD.value)
+                     records.TestSummaryEntryType.RECORD.value)
     self.assertEqual(summary_entries[2]['Type'],
-             records.TestSummaryEntryType.CONTROLLER_INFO.value)
+                     records.TestSummaryEntryType.CONTROLLER_INFO.value)
     self.assertEqual(summary_entries[3]['Type'],
-             records.TestSummaryEntryType.SUMMARY.value)
+                     records.TestSummaryEntryType.SUMMARY.value)
 
   def test_run(self):
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     self.base_mock_test_config.controller_configs[
-      mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = '*'
+        mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = '*'
     with tr.mobly_logger():
       tr.add_test_class(self.base_mock_test_config,
-                integration_test.IntegrationTest)
+                        integration_test.IntegrationTest)
       tr.run()
     results = tr.results.summary_dict()
     self.assertEqual(results['Requested'], 1)
@@ -169,9 +165,9 @@
   def test_run_without_mobly_logger_context(self):
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     self.base_mock_test_config.controller_configs[
-      mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = '*'
+        mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = '*'
     tr.add_test_class(self.base_mock_test_config,
-              integration_test.IntegrationTest)
+                      integration_test.IntegrationTest)
     tr.run()
     results = tr.results.summary_dict()
     self.assertEqual(results['Requested'], 1)
@@ -182,15 +178,15 @@
     self.assertEqual(record.test_class, 'IntegrationTest')
 
   @mock.patch('mobly.controllers.android_device_lib.adb.AdbProxy',
-        return_value=mock_android_device.MockAdbProxy(1))
+              return_value=mock_android_device.MockAdbProxy(1))
   @mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
-        return_value=mock_android_device.MockFastbootProxy(1))
+              return_value=mock_android_device.MockFastbootProxy(1))
   @mock.patch('mobly.controllers.android_device.list_adb_devices',
-        return_value=['1'])
+              return_value=['1'])
   @mock.patch('mobly.controllers.android_device.get_all_instances',
-        return_value=mock_android_device.get_mock_ads(1))
+              return_value=mock_android_device.get_mock_ads(1))
   def test_run_two_test_classes(self, mock_get_all, mock_list_adb,
-                  mock_fastboot, mock_adb):
+                                mock_fastboot, mock_adb):
     """Verifies that running more than one test class in one test run works
     properly.
 
@@ -200,22 +196,18 @@
     mock_test_config = self.base_mock_test_config.copy()
     mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
     my_config = [{
-      'serial': 'xxxx',
-      'magic': 'Magic1'
+        'serial': 'xxxx',
+        'magic': 'Magic1'
     }, {
-      'serial': 'xxxx',
-      'magic': 'Magic2'
+        'serial': 'xxxx',
+        'magic': 'Magic2'
     }]
     mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
-    mock_test_config.controller_configs['AndroidDevice'] = [{
-      'serial': '1'
-    }]
+    mock_test_config.controller_configs['AndroidDevice'] = [{'serial': '1'}]
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(mock_test_config,
-                integration2_test.Integration2Test)
-      tr.add_test_class(mock_test_config,
-                integration_test.IntegrationTest)
+      tr.add_test_class(mock_test_config, integration2_test.Integration2Test)
+      tr.add_test_class(mock_test_config, integration_test.IntegrationTest)
       tr.run()
     results = tr.results.summary_dict()
     self.assertEqual(results['Requested'], 2)
@@ -233,20 +225,21 @@
     different configs works properly.
     """
     config1 = self.base_mock_test_config.copy()
-    config1.controller_configs[
-      mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = [{
-        'serial': 'xxxx'
-      }]
+    config1.controller_configs[mock_controller.MOBLY_CONTROLLER_CONFIG_NAME] = [
+        {
+            'serial': 'xxxx'
+        }
+    ]
     config2 = config1.copy()
     config2.user_params['icecream'] = 10
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
       tr.add_test_class(config1,
-                integration_test.IntegrationTest,
-                name_suffix='FirstConfig')
+                        integration_test.IntegrationTest,
+                        name_suffix='FirstConfig')
       tr.add_test_class(config2,
-                integration_test.IntegrationTest,
-                name_suffix='SecondConfig')
+                        integration_test.IntegrationTest,
+                        name_suffix='SecondConfig')
       tr.run()
     results = tr.results.summary_dict()
     self.assertEqual(results['Requested'], 2)
@@ -264,8 +257,7 @@
     mock_test_config = self.base_mock_test_config.copy()
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
     with tr.mobly_logger():
-      tr.add_test_class(mock_test_config,
-                integration3_test.Integration3Test)
+      tr.add_test_class(mock_test_config, integration3_test.Integration3Test)
       with self.assertRaises(signals.TestAbortAll):
         tr.run()
     results = tr.results.summary_dict()
@@ -282,7 +274,7 @@
         r'config with a different log folder \("%s"\) was added.' %
         re.escape(self.log_dir)):
       tr.add_test_class(self.base_mock_test_config,
-                integration_test.IntegrationTest)
+                        integration_test.IntegrationTest)
 
   def test_add_test_class_mismatched_testbed_name(self):
     tr = test_runner.TestRunner(self.log_dir, 'different_test_bed')
@@ -292,7 +284,7 @@
         r'config with a different test bed \("%s"\) was added.' %
         self.testbed_name):
       tr.add_test_class(self.base_mock_test_config,
-                integration_test.IntegrationTest)
+                        integration_test.IntegrationTest)
 
   def test_run_no_tests(self):
     tr = test_runner.TestRunner(self.log_dir, self.testbed_name)
@@ -300,17 +292,16 @@
       tr.run()
 
   @mock.patch('mobly.test_runner._find_test_class',
-        return_value=type('SampleTest', (), {}))
+              return_value=type('SampleTest', (), {}))
   @mock.patch('mobly.test_runner.config_parser.load_test_config_file',
-        return_value=[config_parser.TestRunConfig()])
+              return_value=[config_parser.TestRunConfig()])
   @mock.patch('mobly.test_runner.TestRunner', return_value=mock.MagicMock())
-  def test_main_parse_args(self, mock_test_runner, mock_config,
-               mock_find_test):
+  def test_main_parse_args(self, mock_test_runner, mock_config, mock_find_test):
     test_runner.main(['-c', 'some/path/foo.yaml', '-b', 'hello'])
     mock_config.assert_called_with('some/path/foo.yaml', None)
 
   @mock.patch('mobly.test_runner._find_test_class',
-        return_value=integration_test.IntegrationTest)
+              return_value=integration_test.IntegrationTest)
   @mock.patch('sys.exit')
   def test_main(self, mock_exit, mock_find_test):
     tmp_file_path = os.path.join(self.tmp_dir, 'config.yml')
@@ -329,7 +320,7 @@
     mock_exit.assert_not_called()
 
   @mock.patch('mobly.test_runner._find_test_class',
-        return_value=integration_test.IntegrationTest)
+              return_value=integration_test.IntegrationTest)
   @mock.patch('sys.exit')
   def test_main_with_failures(self, mock_exit, mock_find_test):
     tmp_file_path = os.path.join(self.tmp_dir, 'config.yml')
@@ -356,8 +347,7 @@
 
   def test__find_test_class_when_multiple_test_classes(self):
     with self.assertRaises(SystemExit):
-      with mock.patch.dict('sys.modules',
-                 __main__=multiple_subclasses_module):
+      with mock.patch.dict('sys.modules', __main__=multiple_subclasses_module):
         test_class = test_runner._find_test_class()
 
   def test_print_test_names(self):
@@ -376,7 +366,7 @@
     mock_test_class.return_value = mock_cls_instance
     test_runner._print_test_names(mock_test_class)
     mock_cls_instance.setup_generated_tests.side_effect = Exception(
-      'Something went wrong.')
+        'Something went wrong.')
     mock_cls_instance._controller_manager.unregister_controllers.assert_called_once(
     )
 
diff --git a/tests/mobly/test_suite_test.py b/tests/mobly/test_suite_test.py
index 6e52461..e490876 100755
--- a/tests/mobly/test_suite_test.py
+++ b/tests/mobly/test_suite_test.py
@@ -33,12 +33,13 @@
 
   Tests here target a combination of test_runner and base_test code.
   """
+
   def setUp(self):
     self.tmp_dir = tempfile.mkdtemp()
     self.mock_test_cls_configs = config_parser.TestRunConfig()
     self.summary_file = os.path.join(self.tmp_dir, 'summary.yaml')
     self.mock_test_cls_configs.summary_writer = records.TestSummaryWriter(
-      self.summary_file)
+        self.summary_file)
     self.mock_test_cls_configs.log_path = self.tmp_dir
     self.mock_test_cls_configs.user_params = {"some_param": "hahaha"}
     self.mock_test_cls_configs.reporter = mock.MagicMock()
@@ -46,8 +47,8 @@
     self.base_mock_test_config.testbed_name = 'SampleTestBed'
     self.base_mock_test_config.controller_configs = {}
     self.base_mock_test_config.user_params = {
-      'icecream': 42,
-      'extra_param': 'haha'
+        'icecream': 42,
+        'extra_param': 'haha'
     }
     self.base_mock_test_config.log_path = self.tmp_dir
 
@@ -59,15 +60,16 @@
     test_run_config.controller_configs = {'MagicDevice': [{'serial': 1}]}
 
     class FooTest(base_test.BaseTestClass):
+
       def setup_class(cls1):
         self.controller1 = cls1.register_controller(mock_controller)[0]
 
     class BarTest(base_test.BaseTestClass):
+
       def setup_class(cls2):
         self.controller2 = cls2.register_controller(mock_controller)[0]
 
-    tr = test_runner.TestRunner(self.tmp_dir,
-                  test_run_config.testbed_name)
+    tr = test_runner.TestRunner(self.tmp_dir, test_run_config.testbed_name)
     with tr.mobly_logger():
       tr.add_test_class(test_run_config, FooTest)
       tr.add_test_class(test_run_config, BarTest)
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index 7f1bf80..f047827 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -46,6 +46,7 @@
   """This test class has unit tests for the implementation of everything
   under mobly.utils.
   """
+
   def setUp(self):
     system = platform.system()
     self.tmp_dir = tempfile.mkdtemp()
@@ -82,12 +83,12 @@
     out = utils.run_command(mock_command)
     self.assertEqual(out, (0, 'fake_out', 'fake_err'))
     mock_Popen.assert_called_with(
-      mock_command,
-      stdout=subprocess.PIPE,
-      stderr=subprocess.PIPE,
-      shell=False,
-      cwd=None,
-      env=None,
+        mock_command,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        shell=False,
+        cwd=None,
+        env=None,
     )
     mock_Timer.assert_not_called()
 
@@ -104,19 +105,19 @@
     mock_proc.communicate.return_value = ('fake_out', 'fake_err')
     mock_proc.returncode = 127
     out = utils.run_command(mock_command,
-                stdout=mock_stdout,
-                stderr=mock_stderr,
-                shell=mock_shell,
-                timeout=mock_timeout,
-                env=mock_env)
+                            stdout=mock_stdout,
+                            stderr=mock_stderr,
+                            shell=mock_shell,
+                            timeout=mock_timeout,
+                            env=mock_env)
     self.assertEqual(out, (127, 'fake_out', 'fake_err'))
     mock_Popen.assert_called_with(
-      mock_command,
-      stdout=mock_stdout,
-      stderr=mock_stderr,
-      shell=mock_shell,
-      cwd=None,
-      env=mock_env,
+        mock_command,
+        stdout=mock_stdout,
+        stderr=mock_stderr,
+        shell=mock_shell,
+        cwd=None,
+        env=mock_env,
     )
     mock_Timer.assert_called_with(1234, mock.ANY)
 
@@ -134,12 +135,12 @@
   def test_start_standing_subproc_without_env(self, mock_Popen):
     p = utils.start_standing_subprocess(self.sleep_cmd(0.01))
     mock_Popen.assert_called_with(
-      self.sleep_cmd(0.01),
-      stdin=subprocess.PIPE,
-      stdout=subprocess.PIPE,
-      stderr=subprocess.PIPE,
-      shell=False,
-      env=None,
+        self.sleep_cmd(0.01),
+        stdin=subprocess.PIPE,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        shell=False,
+        env=None,
     )
 
   @mock.patch('subprocess.Popen')
@@ -147,12 +148,12 @@
     mock_env = mock.MagicMock(spec=dict)
     p = utils.start_standing_subprocess(self.sleep_cmd(0.01), env=mock_env)
     mock_Popen.assert_called_with(
-      self.sleep_cmd(0.01),
-      stdin=subprocess.PIPE,
-      stdout=subprocess.PIPE,
-      stderr=subprocess.PIPE,
-      shell=False,
-      env=mock_env,
+        self.sleep_cmd(0.01),
+        stdin=subprocess.PIPE,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        shell=False,
+        env=mock_env,
     )
 
   def test_stop_standing_subproc(self):
@@ -169,16 +170,16 @@
     self.assertFalse(p1.is_running())
 
   @unittest.skipIf(sys.version_info >= (3, 4) and sys.version_info < (3, 5),
-           'Python 3.4 does not support `None` max_workers.')
+                   'Python 3.4 does not support `None` max_workers.')
   def test_concurrent_exec_when_none_workers(self):
+
     def adder(a, b):
       return a + b
 
-    with mock.patch.object(
-        futures, 'ThreadPoolExecutor',
-        wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
-      results = utils.concurrent_exec(adder, [(1, 1), (2, 2)],
-                      max_workers=None)
+    with mock.patch.object(futures,
+                           'ThreadPoolExecutor',
+                           wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
+      results = utils.concurrent_exec(adder, [(1, 1), (2, 2)], max_workers=None)
 
     thread_pool_spy.assert_called_once_with(max_workers=None)
 
@@ -187,12 +188,13 @@
     self.assertIn(4, results)
 
   def test_concurrent_exec_when_default_max_workers(self):
+
     def adder(a, b):
       return a + b
 
-    with mock.patch.object(
-        futures, 'ThreadPoolExecutor',
-        wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
+    with mock.patch.object(futures,
+                           'ThreadPoolExecutor',
+                           wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
       results = utils.concurrent_exec(adder, [(1, 1), (2, 2)])
 
     thread_pool_spy.assert_called_once_with(max_workers=30)
@@ -202,14 +204,14 @@
     self.assertIn(4, results)
 
   def test_concurrent_exec_when_custom_max_workers(self):
+
     def adder(a, b):
       return a + b
 
-    with mock.patch.object(
-        futures, 'ThreadPoolExecutor',
-        wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
-      results = utils.concurrent_exec(adder, [(1, 1), (2, 2)],
-                      max_workers=1)
+    with mock.patch.object(futures,
+                           'ThreadPoolExecutor',
+                           wraps=futures.ThreadPoolExecutor) as thread_pool_spy:
+      results = utils.concurrent_exec(adder, [(1, 1), (2, 2)], max_workers=1)
 
     thread_pool_spy.assert_called_once_with(max_workers=1)
     self.assertEqual(len(results), 2)
@@ -219,18 +221,17 @@
   def test_concurrent_exec_makes_all_calls(self):
     mock_function = mock.MagicMock()
     _ = utils.concurrent_exec(mock_function, [
-      (1, 1),
-      (2, 2),
-      (3, 3),
+        (1, 1),
+        (2, 2),
+        (3, 3),
     ])
     self.assertEqual(mock_function.call_count, 3)
     mock_function.assert_has_calls(
-      [mock.call(1, 1),
-       mock.call(2, 2),
-       mock.call(3, 3)],
-      any_order=True)
+        [mock.call(1, 1), mock.call(2, 2),
+         mock.call(3, 3)], any_order=True)
 
   def test_concurrent_exec_generates_results(self):
+
     def adder(a, b):
       return a + b
 
@@ -243,50 +244,48 @@
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
 
     results = utils.concurrent_exec(fake_int, [
-      (1, ),
-      ('123', ),
-      ('not_int', ),
-      (5435, ),
+        (1,),
+        ('123',),
+        ('not_int',),
+        (5435,),
     ])
 
     self.assertEqual(mock_call_recorder.call_count, 4)
     mock_call_recorder.assert_has_calls([
-      mock.call(1),
-      mock.call('123'),
-      mock.call('not_int'),
-      mock.call(5435),
+        mock.call(1),
+        mock.call('123'),
+        mock.call('not_int'),
+        mock.call(5435),
     ],
-                      any_order=True)
+                                        any_order=True)
 
   def test_concurrent_exec_when_exception_generates_results(self):
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
 
     results = utils.concurrent_exec(fake_int, [
-      (1, ),
-      ('123', ),
-      ('not_int', ),
-      (5435, ),
+        (1,),
+        ('123',),
+        ('not_int',),
+        (5435,),
     ])
 
     self.assertEqual(len(results), 4)
     self.assertIn(1, results)
     self.assertIn(123, results)
     self.assertIn(5435, results)
-    exceptions = [
-      result for result in results if isinstance(result, Exception)
-    ]
+    exceptions = [result for result in results if isinstance(result, Exception)]
     self.assertEqual(len(exceptions), 1)
     self.assertIsInstance(exceptions[0], ValueError)
 
@@ -294,60 +293,59 @@
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
 
     results = utils.concurrent_exec(fake_int, [
-      (1, ),
-      ('not_int1', ),
-      ('not_int2', ),
-      (5435, ),
+        (1,),
+        ('not_int1',),
+        ('not_int2',),
+        (5435,),
     ])
 
     self.assertEqual(mock_call_recorder.call_count, 4)
     mock_call_recorder.assert_has_calls([
-      mock.call(1),
-      mock.call('not_int1'),
-      mock.call('not_int2'),
-      mock.call(5435),
+        mock.call(1),
+        mock.call('not_int1'),
+        mock.call('not_int2'),
+        mock.call(5435),
     ],
-                      any_order=True)
+                                        any_order=True)
 
   def test_concurrent_exec_when_multiple_exceptions_generates_results(self):
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
 
     results = utils.concurrent_exec(fake_int, [
-      (1, ),
-      ('not_int1', ),
-      ('not_int2', ),
-      (5435, ),
+        (1,),
+        ('not_int1',),
+        ('not_int2',),
+        (5435,),
     ])
 
     self.assertEqual(len(results), 4)
     self.assertIn(1, results)
     self.assertIn(5435, results)
-    exceptions = [
-      result for result in results if isinstance(result, Exception)
-    ]
+    exceptions = [result for result in results if isinstance(result, Exception)]
     self.assertEqual(len(exceptions), 2)
     self.assertIsInstance(exceptions[0], ValueError)
     self.assertIsInstance(exceptions[1], ValueError)
     self.assertNotEqual(exceptions[0], exceptions[1])
 
   def test_concurrent_exec_when_raising_exception_generates_results(self):
+
     def adder(a, b):
       return a + b
 
     results = utils.concurrent_exec(adder, [(1, 1), (2, 2)],
-                    raise_on_exception=True)
+                                    raise_on_exception=True)
     self.assertEqual(len(results), 2)
     self.assertIn(2, results)
     self.assertIn(4, results)
@@ -356,35 +354,35 @@
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
 
     with self.assertRaisesRegex(RuntimeError, '.*not_int.*'):
       _ = utils.concurrent_exec(fake_int, [
-        (1, ),
-        ('123', ),
-        ('not_int', ),
-        (5435, ),
+          (1,),
+          ('123',),
+          ('not_int',),
+          (5435,),
       ],
-                    raise_on_exception=True)
+                                raise_on_exception=True)
 
     self.assertEqual(mock_call_recorder.call_count, 4)
     mock_call_recorder.assert_has_calls([
-      mock.call(1),
-      mock.call('123'),
-      mock.call('not_int'),
-      mock.call(5435),
+        mock.call(1),
+        mock.call('123'),
+        mock.call('not_int'),
+        mock.call(5435),
     ],
-                      any_order=True)
+                                        any_order=True)
 
   def test_concurrent_exec_when_raising_multiple_exceptions_makes_all_calls(
       self):
     mock_call_recorder = mock.MagicMock()
     lock_call_count = threading.Lock()
 
-    def fake_int(a, ):
+    def fake_int(a,):
       with lock_call_count:
         mock_call_recorder(a)
       return int(a)
@@ -393,21 +391,21 @@
         RuntimeError,
         r'(?m).*(not_int1(.|\s)+not_int2|not_int2(.|\s)+not_int1).*'):
       _ = utils.concurrent_exec(fake_int, [
-        (1, ),
-        ('not_int1', ),
-        ('not_int2', ),
-        (5435, ),
+          (1,),
+          ('not_int1',),
+          ('not_int2',),
+          (5435,),
       ],
-                    raise_on_exception=True)
+                                raise_on_exception=True)
 
     self.assertEqual(mock_call_recorder.call_count, 4)
     mock_call_recorder.assert_has_calls([
-      mock.call(1),
-      mock.call('not_int1'),
-      mock.call('not_int2'),
-      mock.call(5435),
+        mock.call(1),
+        mock.call('not_int1'),
+        mock.call('not_int2'),
+        mock.call(5435),
     ],
-                      any_order=True)
+                                        any_order=True)
 
   def test_create_dir(self):
     new_path = os.path.join(self.tmp_dir, 'haha')
@@ -420,26 +418,26 @@
     utils.create_dir(self.tmp_dir)
     self.assertTrue(os.path.exists(self.tmp_dir))
 
-  @mock.patch(
-    'mobly.controllers.android_device_lib.adb.list_occupied_adb_ports')
+  @mock.patch('mobly.controllers.android_device_lib.adb.list_occupied_adb_ports'
+             )
   @mock.patch('portpicker.PickUnusedPort', return_value=MOCK_AVAILABLE_PORT)
   def test_get_available_port_positive(self, mock_list_occupied_adb_ports,
-                     mock_pick_unused_port):
+                                       mock_pick_unused_port):
     self.assertEqual(utils.get_available_host_port(), MOCK_AVAILABLE_PORT)
 
   @mock.patch(
-    'mobly.controllers.android_device_lib.adb.list_occupied_adb_ports',
-    return_value=[MOCK_AVAILABLE_PORT])
+      'mobly.controllers.android_device_lib.adb.list_occupied_adb_ports',
+      return_value=[MOCK_AVAILABLE_PORT])
   @mock.patch('portpicker.PickUnusedPort', return_value=MOCK_AVAILABLE_PORT)
   def test_get_available_port_negative(self, mock_list_occupied_adb_ports,
-                     mock_pick_unused_port):
+                                       mock_pick_unused_port):
     with self.assertRaisesRegex(utils.Error, 'Failed to find.* retries'):
       utils.get_available_host_port()
 
-  @mock.patch(
-    'mobly.controllers.android_device_lib.adb.list_occupied_adb_ports')
-  def test_get_available_port_returns_free_port(
-      self, mock_list_occupied_adb_ports):
+  @mock.patch('mobly.controllers.android_device_lib.adb.list_occupied_adb_ports'
+             )
+  def test_get_available_port_returns_free_port(self,
+                                                mock_list_occupied_adb_ports):
     """Verifies logic to pick a free port on the host.
 
     Test checks we can bind to either an ipv4 or ipv6 socket on the port
@@ -467,7 +465,7 @@
     with io.open(tmp_file_path, 'wb') as f:
       f.write(b'Hellow world!')
     self.assertEqual(utils.load_file_to_base64_str(tmp_file_path),
-             expected_base64_encoding)
+                     expected_base64_encoding)
 
   def test_load_file_to_base64_str_reads_text_file_as_base64_string(self):
     tmp_file_path = os.path.join(self.tmp_dir, 'b64.bin')
@@ -475,7 +473,7 @@
     with io.open(tmp_file_path, 'w', encoding='utf-8') as f:
       f.write(u'Hellow world!')
     self.assertEqual(utils.load_file_to_base64_str(tmp_file_path),
-             expected_base64_encoding)
+                     expected_base64_encoding)
 
   def test_load_file_to_base64_str_reads_unicode_file_as_base64_string(self):
     tmp_file_path = os.path.join(self.tmp_dir, 'b64.bin')
@@ -483,7 +481,7 @@
     with io.open(tmp_file_path, 'w', encoding='utf-8') as f:
       f.write(u'\u901a')
     self.assertEqual(utils.load_file_to_base64_str(tmp_file_path),
-             expected_base64_encoding)
+                     expected_base64_encoding)
 
   def test_cli_cmd_to_string(self):
     cmd = ['"adb"', 'a b', 'c//']
@@ -492,6 +490,7 @@
     self.assertEqual(utils.cli_cmd_to_string(cmd), cmd)
 
   def test_get_settable_properties(self):
+
     class SomeClass(object):
       regular_attr = 'regular_attr'
       _foo = 'foo'
@@ -517,75 +516,72 @@
 
   def test_find_subclasses_in_module_when_one_subclass(self):
     subclasses = utils.find_subclasses_in_module([base_test.BaseTestClass],
-                           integration_test)
+                                                 integration_test)
     self.assertEqual(len(subclasses), 1)
     self.assertEqual(subclasses[0], integration_test.IntegrationTest)
 
   def test_find_subclasses_in_module_when_indirect_subclass(self):
     subclasses = utils.find_subclasses_in_module([base_test.BaseTestClass],
-                           mock_instrumentation_test)
+                                                 mock_instrumentation_test)
     self.assertEqual(len(subclasses), 1)
     self.assertEqual(subclasses[0],
-             mock_instrumentation_test.MockInstrumentationTest)
+                     mock_instrumentation_test.MockInstrumentationTest)
 
   def test_find_subclasses_in_module_when_no_subclasses(self):
     subclasses = utils.find_subclasses_in_module([base_test.BaseTestClass],
-                           mock_controller)
+                                                 mock_controller)
     self.assertEqual(len(subclasses), 0)
 
   def test_find_subclasses_in_module_when_multiple_subclasses(self):
-    subclasses = utils.find_subclasses_in_module(
-      [base_test.BaseTestClass], multiple_subclasses_module)
+    subclasses = utils.find_subclasses_in_module([base_test.BaseTestClass],
+                                                 multiple_subclasses_module)
     self.assertEqual(len(subclasses), 2)
     self.assertIn(multiple_subclasses_module.Subclass1Test, subclasses)
     self.assertIn(multiple_subclasses_module.Subclass2Test, subclasses)
 
   def test_find_subclasses_in_module_when_multiple_base_classes(self):
     subclasses = utils.find_subclasses_in_module(
-      [base_test.BaseTestClass, test_runner.TestRunner],
-      multiple_subclasses_module)
+        [base_test.BaseTestClass, test_runner.TestRunner],
+        multiple_subclasses_module)
     self.assertEqual(len(subclasses), 4)
     self.assertIn(multiple_subclasses_module.Subclass1Test, subclasses)
     self.assertIn(multiple_subclasses_module.Subclass2Test, subclasses)
     self.assertIn(multiple_subclasses_module.Subclass1Runner, subclasses)
     self.assertIn(multiple_subclasses_module.Subclass2Runner, subclasses)
 
-  def test_find_subclasses_in_module_when_only_some_base_classes_present(
-      self):
+  def test_find_subclasses_in_module_when_only_some_base_classes_present(self):
     subclasses = utils.find_subclasses_in_module(
-      [signals.TestSignal, test_runner.TestRunner],
-      multiple_subclasses_module)
+        [signals.TestSignal, test_runner.TestRunner],
+        multiple_subclasses_module)
     self.assertEqual(len(subclasses), 2)
     self.assertIn(multiple_subclasses_module.Subclass1Runner, subclasses)
     self.assertIn(multiple_subclasses_module.Subclass2Runner, subclasses)
 
   def test_find_subclass_in_module_when_one_subclass(self):
     subclass = utils.find_subclass_in_module(base_test.BaseTestClass,
-                         integration_test)
+                                             integration_test)
     self.assertEqual(subclass, integration_test.IntegrationTest)
 
   def test_find_subclass_in_module_when_indirect_subclass(self):
     subclass = utils.find_subclass_in_module(base_test.BaseTestClass,
-                         mock_instrumentation_test)
+                                             mock_instrumentation_test)
     self.assertEqual(subclass,
-             mock_instrumentation_test.MockInstrumentationTest)
+                     mock_instrumentation_test.MockInstrumentationTest)
 
   def test_find_subclass_in_module_when_no_subclasses(self):
     with self.assertRaisesRegex(
-        ValueError,
-        '.*Expected 1 subclass of BaseTestClass per module, found'
+        ValueError, '.*Expected 1 subclass of BaseTestClass per module, found'
         r' \[\].*'):
       _ = utils.find_subclass_in_module(base_test.BaseTestClass,
-                        mock_controller)
+                                        mock_controller)
 
   def test_find_subclass_in_module_when_multiple_subclasses(self):
     with self.assertRaisesRegex(
-        ValueError,
-        '.*Expected 1 subclass of BaseTestClass per module, found'
+        ValueError, '.*Expected 1 subclass of BaseTestClass per module, found'
         r' \[(\'Subclass1Test\', \'Subclass2Test\''
         r'|\'Subclass2Test\', \'Subclass1Test\')\].*'):
       _ = utils.find_subclass_in_module(base_test.BaseTestClass,
-                        multiple_subclasses_module)
+                                        multiple_subclasses_module)
 
 
 if __name__ == '__main__':
diff --git a/tools/sl4a_shell.py b/tools/sl4a_shell.py
index efeb129..e8365da 100755
--- a/tools/sl4a_shell.py
+++ b/tools/sl4a_shell.py
@@ -41,6 +41,7 @@
 
 
 class Sl4aShell(jsonrpc_shell_base.JsonRpcShellBase):
+
   def _start_services(self, console_env):
     """Overrides superclass."""
     self._ad.services.register('sl4a', sl4a_service.Sl4aService)
@@ -50,21 +51,19 @@
 
   def _get_banner(self, serial):
     lines = [
-      'Connected to %s.' % serial, 'Call methods against:',
-      '    ad (android_device.AndroidDevice)', '    sl4a or s (SL4A)',
-      '    ed (EventDispatcher)'
+        'Connected to %s.' % serial, 'Call methods against:',
+        '    ad (android_device.AndroidDevice)', '    sl4a or s (SL4A)',
+        '    ed (EventDispatcher)'
     ]
     return '\n'.join(lines)
 
 
 if __name__ == '__main__':
-  parser = argparse.ArgumentParser(
-    description='Interactive client for sl4a.')
+  parser = argparse.ArgumentParser(description='Interactive client for sl4a.')
   parser.add_argument(
-    '-s',
-    '--serial',
-    help=
-    'Device serial to connect to (if more than one device is connected)')
+      '-s',
+      '--serial',
+      help='Device serial to connect to (if more than one device is connected)')
   args = parser.parse_args()
   logging.basicConfig(level=logging.INFO)
   Sl4aShell().main(args.serial)
diff --git a/tools/snippet_shell.py b/tools/snippet_shell.py
index 022c92c..fb3d011 100755
--- a/tools/snippet_shell.py
+++ b/tools/snippet_shell.py
@@ -35,6 +35,7 @@
 
 
 class SnippetShell(jsonrpc_shell_base.JsonRpcShellBase):
+
   def __init__(self, package):
     self._package = package
 
@@ -46,31 +47,27 @@
 
   def _get_banner(self, serial):
     lines = [
-      'Connected to %s.' % serial, 'Call methods against:',
-      '    ad (android_device.AndroidDevice)',
-      '    snippet or s (Snippet)'
+        'Connected to %s.' % serial, 'Call methods against:',
+        '    ad (android_device.AndroidDevice)', '    snippet or s (Snippet)'
     ]
     return '\n'.join(lines)
 
 
 if __name__ == '__main__':
   parser = argparse.ArgumentParser(
-    description='Interactive client for Mobly code snippets.')
+      description='Interactive client for Mobly code snippets.')
   parser.add_argument(
-    '-s',
-    '--serial',
-    help=
-    'Device serial to connect to (if more than one device is connected)')
-  parser.add_argument(
-    'package',
-    metavar='PACKAGE_NAME',
-    type=str,
-    nargs='?',
-    help='The package name of the snippet to use.')
-  parser.add_argument(
-    '--mbs',
-    help='Whether to connect to Mobly Bundled Snippets',
-    action='store_true')
+      '-s',
+      '--serial',
+      help='Device serial to connect to (if more than one device is connected)')
+  parser.add_argument('package',
+                      metavar='PACKAGE_NAME',
+                      type=str,
+                      nargs='?',
+                      help='The package name of the snippet to use.')
+  parser.add_argument('--mbs',
+                      help='Whether to connect to Mobly Bundled Snippets',
+                      action='store_true')
   args = parser.parse_args()
   if args.package and args.mbs:
     print('Cannot specify both --package and --mbs', file=sys.stderr)