def encode(*args, **kwargs):
    """
    A helper function to encode an element.

    @param args: The python data to be encoded.
    @kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
    @return: A L{util.BufferedByteStream} object that contains the data.
    """
    encoding = kwargs.pop('encoding', DEFAULT_ENCODING)
    encoder = get_encoder(encoding, **kwargs)

    [encoder.writeElement(el) for el in args]

    stream = encoder.stream
    stream.seek(0)

    return stream
def encode ( * args , ** kwargs ) : encoding = kwargs . pop ( 'encoding' , DEFAULT_ENCODING ) encoder = get_encoder ( encoding , ** kwargs ) [ encoder . writeElement ( el ) for el in args ] stream = encoder . stream stream . seek ( 0 ) return stream
A helper function to encode an element.

    @param args: The python data to be encoded.
    @kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
    @return: A L{util.BufferedByteStream} object that contains the data.