code: def monitor():
      
      parser = argparse.ArgumentParser(description=__doc__)
      parser.add_argument('--device', default='/dev/ttyUSB0',
                          help='Path to PLM device')
      parser.add_argument('--verbose', '-v', action='count',
                          help='Set logging level to verbose')
      parser.add_argument('-l', '--logfile', default='',
                          help='Log file name')
      parser.add_argument('--workdir', default='',
                          help='Working directory for reading and saving '
                          'device information.')
  
      args = parser.parse_args()
      loop = asyncio.get_event_loop()
      monTool = Tools(loop, args)
      asyncio.ensure_future(monTool.monitor_mode())
      try:
          loop.run_forever()
      except KeyboardInterrupt:
          if monTool.plm:
              if monTool.plm.transport:
                  _LOGGING.info('Closing the session')
                  asyncio.ensure_future(monTool.plm.transport.close(), loop=loop)
          loop.stop()
          pending = asyncio.Task.all_tasks(loop=loop)
          for task in pending:
              task.cancel()
              try:
                  loop.run_until_complete(task)
              except asyncio.CancelledError:
                  pass
              except KeyboardInterrupt:
                  pass
          loop.close()
docs: Connect to receiver and show events as they occur.
  
      Pulls the following arguments from the command line:
  
      :param device:
          Unix device where the PLM is attached
      :param address:
          Insteon address of the device to link with
      :param group:
          Insteon group for the link
      :param: linkcode
          Link direction: 0 - PLM is responder
                          1 - PLM is controller
                          3 - IM is responder or controller'
      :param verbose:
          Show debug logging.