code: def request(self, command, message=None):
          
          if message is not None:
              message = Message.serialize(message)
          packet = Packet.request(command, message)
          response = self._communicate(packet)
  
          if response.response_type != Packet.CMD_RESPONSE:
              raise SessionException(
                  "Unexpected response type {type}, "
                  "expected '{response}' (CMD_RESPONSE)".format(
                      type=response.response_type,
                      response=Packet.CMD_RESPONSE
                  )
              )
  
          return Message.deserialize(response.payload)
docs: Send command request with an optional message.
  
          :param command: command to send
          :type command: str
          :param message: message (optional)
          :type message: str
          :return: command result
          :rtype: dict