code: def pack_rpc_response(response=None, exception=None):
      
  
      if response is None:
          response = bytes()
  
      if exception is None:
          status = (1 << 6)
          if len(response) > 0:
              status |= (1 << 7)
      elif isinstance(exception, (RPCInvalidIDError, RPCNotFoundError)):
          status = 2
      elif isinstance(exception, BusyRPCResponse):
          status = 0
      elif isinstance(exception, TileNotFoundError):
          status = 0xFF
      elif isinstance(exception, RPCErrorCode):
          status = (1 << 6) | (exception.params['code'] & ((1 << 6) - 1))
      else:
          status = 3
  
      return status, response
docs: Convert a response payload or exception to a status code and payload.
  
      This function will convert an Exception raised by an RPC implementation
      to the corresponding status code.