(params, methodname=None, methodresponse=None, encoding=None,
          allow_none=False)
return "".join(data)
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 byte strings in the data structure are assumed to use the
    packet encoding.  Unicode strings are automatically converted,
    where necessary.
data [,options] -> marshalled data
data [ options ] - > marshalled data
def dumps(params, methodname=None, methodresponse=None, encoding=None,
          allow_none=False):
    """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 byte strings in the data structure are assumed to use the
    packet encoding.  Unicode strings are automatically converted,
    where necessary.
    """

    assert isinstance(params, (tuple, Fault)), "argument must be tuple or Fault instance"
    if isinstance(params, Fault):
        methodresponse = 1
    elif methodresponse and isinstance(params, tuple):
        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
        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 "".join(data)
def dumps ( params , methodname = None , methodresponse = None , encoding = None , allow_none = False ) : assert isinstance ( params , ( tuple , Fault ) ) , "argument must be tuple or Fault instance" if isinstance ( params , Fault ) : methodresponse = 1 elif methodresponse and isinstance ( params , tuple ) : 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 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 "" . join ( data )