docs: def message_to_item(cls, message):
          '''Translate an unframed received message and return an
          (item, request_id) pair.
  
          The item can be a Request, Notification, Response or a list.
  
          A JSON RPC error response is returned as an RPCError inside a
          Response object.
  
          If a Batch is returned, request_id is an iterable of request
          ids, one per batch member.
  
          If the message violates the protocol in some way a
          ProtocolError is returned, except if the message was
          determined to be a response, in which case the ProtocolError
          is placed inside a Response object.  This is so that client
          code can mark a request as having been responded to even if
          the response was bad.
  
          raises: ProtocolError
          '''
          payload = cls._message_to_payload(message)
          if isinstance(payload, dict):
              if 'method' in payload:
                  return cls._process_request(payload)
              else:
                  return cls._process_response(payload)
          elif isinstance(payload, list) and cls.allow_batches:
              if not payload:
                  raise cls._error(JSONRPC.INVALID_REQUEST, 'batch is empty',
                                   True, None)
              return payload, None
          raise cls._error(cls.INVALID_REQUEST,
                           'request object must be a dictionary', True, None)