code: def assemble_request(method, params=None, notification=False):
          
  
          if not isinstance(method, (str, unicode)):
              raise TypeError('"method" must be a string (or unicode string).')
          if params and not isinstance(params, (tuple, list, dict)):
              raise TypeError("params must be a tuple/list/dict or None.")
  
          base = {
              "jsonrpc": "2.0",
              "method": method
          }
  
          if params:
              base["params"] = params
  
          if not notification:
              base['id'] = str(uuid.uuid4())
  
          return base
docs: serialize JSON-RPC-Request
  
          :Parameters:
              - method: the method-name (str/unicode)
              - params: the parameters (None/list/tuple/dict)
              - notification: bool
          :Returns:   | {"jsonrpc": "2.0", "method": "...", "params": ..., "id": ...}
                      | "jsonrpc", "method", "params" and "id" are always in this order.
                      | "params" is omitted if empty
          :Raises:    TypeError if method/params is of wrong type or
                      not JSON-serializable