def encode(obj):
    """ Encode an object for proper decoding by Java or ObjC
    """
    if hasattr(obj, '__id__'):
        return msgpack.ExtType(ExtType.REF, msgpack.packb(obj.__id__))
    return obj
def encode ( obj ) : if hasattr ( obj , '__id__' ) : return msgpack . ExtType ( ExtType . REF , msgpack . packb ( obj . __id__ ) ) return obj
Encode an object for proper decoding by Java or ObjC