docs: def _serial_connect(self, port, request):
          '''
          Handle connection request.
  
          Parameters
          ----------
          port : str
              Device name/port.
          request : dict
          '''
          #     baudrate : int
          #         Baud rate such as 9600 or 115200 etc.
          #     bytesize : str, optional
          #         Number of data bits.
          #
          #         Possible values: ``'FIVEBITS'``, ``'SIXBITS'``, ``'SEVENBITS'``,
          #         ``'EIGHTBITS'``.
          #
          #         Default: ``'EIGHTBITS'``
          #     parity : str, optional
          #         Enable parity checking.
          #
          #         Possible values: ``'PARITY_NONE'``, ``'PARITY_EVEN'``, ``'PARITY_ODD'``,
          #         ``'PARITY_MARK'``, ``'PARITY_SPACE'``.
          #
          #         Default: ``'PARITY_NONE'``
          #     stopbits : str, optional
          #         Number of stop bits.
          #
          #         Possible values: STOPBITS_ONE, STOPBITS_ONE_POINT_FIVE, STOPBITS_TWO
          #     xonxoff : bool, optional
          #         Enable software flow control.
          #
          #         Default: ``False``
          #     rtscts : bool, optional
          #         Enable hardware (RTS/CTS) flow control.
          #
          #         Default: ``False``
          #     dsrdtr : bool, optional
          #         Enable hardware (DSR/DTR) flow control.
          #
          #         Default: ``False``
          command = 'connect'
          if port in self.open_devices:
              logger.debug('Already connected to: `%s`', port)
              self._publish_status(port)
              return
  
          # TODO Write JSON schema definition for valid connect request.
          if 'baudrate' not in request:
              logger.error('Invalid `%s` request: `baudrate` must be '
                           'specified.', command)
              return
          if 'bytesize' in request:
              try:
                  bytesize = getattr(serial, request['bytesize'])
                  if not bytesize in serial.Serial.BYTESIZES:
                      logger.error('`%s` request: `bytesize` `%s` not '
                                   'available on current platform.', command,
                                   request['bytesize'])
                      return
              except AttributeError as exception:
                  logger.error('`%s` request: invalid `bytesize`, `%s`', command,
                               request['bytesize'])
                  return
          else:
              bytesize = serial.EIGHTBITS
          if 'parity' in request:
              try:
                  parity = getattr(serial, request['parity'])
                  if not parity in serial.Serial.PARITIES:
                      logger.error('`%s` request: `parity` `%s` not available '
                                   'on current platform.', command,
                                   request['parity'])
                      return
              except AttributeError as exception:
                  logger.error('`%s` request: invalid `parity`, `%s`', command,
                               request['parity'])
                  return
          else:
              parity = serial.PARITY_NONE
          if 'stopbits' in request:
              try:
                  stopbits = getattr(serial, request['stopbits'])
                  if not stopbits in serial.Serial.STOPBITS:
                      logger.error('`%s` request: `stopbits` `%s` not '
                                   'available on current platform.', command,
                                   request['stopbits'])
                      return
              except AttributeError as exception:
                  logger.error('`%s` request: invalid `stopbits`, `%s`', command,
                               request['stopbits'])
                  return
          else:
              stopbits = serial.STOPBITS_ONE
  
          try:
              baudrate = int(request['baudrate'])
              xonxoff = bool(request.get('xonxoff'))
              rtscts = bool(request.get('rtscts'))
              dsrdtr = bool(request.get('dsrdtr'))
          except TypeError as exception:
              logger.error('`%s` request: %s', command, exception)
              return
  
          try:
              device = serial.serial_for_url(port, baudrate=baudrate,
                                             bytesize=bytesize, parity=parity,
                                             stopbits=stopbits, xonxoff=xonxoff,
                                             rtscts=rtscts, dsrdtr=dsrdtr)
              parent = self
  
              class PassThroughProtocol(serial.threaded.Protocol):
                  PORT = port
  
                  def connection_made(self, transport):
                      """Called when reader thread is started"""
                      parent.open_devices[port] = transport
                      parent._publish_status(self.PORT)
  
                  def data_received(self, data):
                      """Called with snippets received from the serial port"""
                      parent.mqtt_client.publish(topic='serial_device/%s/received'
                                                 % self.PORT, payload=data)
  
                  def connection_lost(self, exception):
                      """\
                      Called when the serial port is closed or the reader loop terminated
                      otherwise.
                      """
                      if isinstance(exception, Exception):
                          logger.error('Connection to port `%s` lost: %s',
                                       self.PORT, exception)
                      del parent.open_devices[self.PORT]
                      parent._publish_status(self.PORT)
  
              reader_thread = serial.threaded.ReaderThread(device,
                                                           PassThroughProtocol)
              reader_thread.start()
              reader_thread.connect()
          except Exception as exception:
              logger.error('`%s` request: %s', command, exception)
              return