def METHOD_NAME(object):
    # Create a temporary buffer, which we first write the object into, and
    # subsequently read it from again.
    buffer = core.DatagramBuffer()
    writer = core.BamWriter(buffer)
    writer.init()
    writer.write_object(object)
    reader = core.BamReader(buffer)
    reader.init()
    object = reader.read_object()
    reader.resolve()
    return object