def serialize_object(obj, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS):
buffers = []<EOL>if istype(obj, sequence_types) and len(obj) < item_threshold:<EOL><INDENT>cobj = can_sequence(obj)<EOL>for c in cobj:<EOL><INDENT>buffers.extend(_extract_buffers(c, buffer_threshold))<EOL><DEDENT><DEDENT>elif istype(obj, dict) and len(obj) < item_threshold:<EOL><INDENT>cobj = {}<EOL>for k in sorted(obj):<EOL><INDENT>c = can(obj[k])<EOL>buffers.extend(_extract_buffers(c, buffer_threshold))<EOL>cobj[k] = c<EOL><DEDENT><DEDENT>else:<EOL><INDENT>cobj = can(obj)<EOL>buffers.extend(_extract_buffers(cobj, buffer_threshold))<EOL><DEDENT>buffers.insert(<NUM_LIT:0>, pickle.dumps(cobj, PICKLE_PROTOCOL))<EOL>return buffers<EOL>
Serialize an object into a list of sendable buffers.

    Parameters
    ----------

    obj : object
        The object to be serialized
    buffer_threshold : int
        The threshold (in bytes) for pulling out data buffers
        to avoid pickling them.
    item_threshold : int
        The maximum number of items over which canning will iterate.
        Containers (lists, dicts) larger than this will be pickled without
        introspection.

    Returns
    -------
    [bufs] : list of buffers representing the serialized object.