code: def dumps(params, methodname=None, methodresponse=None, encoding=None,
            allow_none=0, utf8_encoding='standard'):
      
  
      assert isinstance(params, TupleType) or isinstance(params, Fault),\
             "argument must be tuple or Fault instance"
  
      if isinstance(params, Fault):
          methodresponse = 1
      elif methodresponse and isinstance(params, TupleType):
          assert len(params) == 1, "response tuple must be a singleton"
  
      if not encoding:
          encoding = "utf-8"
  
      if FastMarshaller:
          m = FastMarshaller(encoding)
      else:
          m = Marshaller(encoding, allow_none)
  
      data = m.dumps(params)
  
      if encoding != "utf-8":
          xmlheader = "<?xml version='1.0' encoding='%s'?>\n" % str(encoding)
      else:
          xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default
  
      # standard XML-RPC wrappings
      if methodname:
          # a method call
          if not isinstance(methodname, StringType):
              methodname = methodname.encode(encoding)
          data = (
              xmlheader,
              "<methodCall>\n"
              "<methodName>", methodname, "</methodName>\n",
              data,
              "</methodCall>\n"
              )
      elif methodresponse:
          # a method response, or a fault structure
          data = (
              xmlheader,
              "<methodResponse>\n",
              data,
              "</methodResponse>\n"
              )
      else:
          return data # return as is
      return string.join(data, "")
docs: data [,options] -> marshalled data
  
      Convert an argument tuple or a Fault instance to an XML-RPC
      request (or response, if the methodresponse option is used).
  
      In addition to the data object, the following options can be given
      as keyword arguments:
  
          methodname: the method name for a methodCall packet
  
          methodresponse: true to create a methodResponse packet.
          If this option is used with a tuple, the tuple must be
          a singleton (i.e. it can contain only one element).
  
          encoding: the packet encoding (default is UTF-8)
  
      All 8-bit strings in the data structure are assumed to use the
      packet encoding.  Unicode strings are automatically converted,
      where necessary.