docs: def main(args=None):
      """
      Phablet command line user interface
  
      This function implements the phablet command line tool
      """
      parser = argparse.ArgumentParser(
          description=_("Run a command on Ubuntu Phablet"),
          epilog="""
          This tool will start ssh on your connected Ubuntu Touch device, forward
          a local port to the device, copy your ssh id down to the device (so you
          can log in without a password), and then ssh into the device through
          the locally forwarded port.
  
          This results in a very nice shell, which for example can display the
          output of 'top' at the correct terminal size, rather than being stuck
          at 80x25 like 'adb shell'
  
          Like ssh-copy-id, this script will push down the newest ssh key it can
          find in ~/.ssh/*.pub, so if you find the wrong key being pushed down,
          simply use 'touch' to make your desired key the newest one, and then
          this script will find it.
          """)
      dev_group = parser.add_argument_group(_("device connection options"))
      dev_group.add_argument(
          '-s', '--serial', action='store',
          help=_('connect to the device with the specified serial number'),
          default=None)
      if hasattr(subprocess, 'TimeoutExpired'):
          dev_group.add_argument(
              '-t', '--timeout', type=float, default=30.0,
              help=_('timeout for device discovery'))
      else:
          dev_group.add_argument(
              '-t', '--timeout', type=float, default=None,
              help=argparse.SUPPRESS)
      dev_group.add_argument(
          '-k', '--public-key', action='store', default=None,
          help=_('use the specified public key'))
      log_group = parser.add_argument_group(_("logging options"))
      log_group.add_argument(
          '--verbose', action='store_const', dest='log_level',
          const='INFO', help=_('be more verbose during connection set-up'))
      log_group.add_argument(
          '--log-level', action='store',
          help=_('set log level (for debugging)'),
          choices=[
              logging.getLevelName(level)
              for level in [
                  logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
                  logging.CRITICAL]])
      parser.add_argument(
          'cmd', nargs='...',
          help=_('command to run on the phablet, '
                 ' if left out an interactive shell is started'))
      parser.add_argument('--version', action='version', version=__version__)
      parser.set_defaults(log_level='WARNING')
      ns = parser.parse_args(args)
      try:
          # Py3k
          level = logging._nameToLevel[ns.log_level]
      except AttributeError:
          # Py27
          level = logging._levelNames[ns.log_level]
      logging.basicConfig(
          level=level, style='{', format="[{levelname:10}] {message}")
      try:
          phablet = Phablet(ns.serial)
          return phablet.run(ns.cmd, timeout=ns.timeout, key=ns.public_key)
      except PhabletError as exc:
          _logger.critical("%s", exc)
          return 255