marshaled_bytecode, pickled_name, pickled_arguments, pickled_closure = (
    receive_from_a_socket())
your_function = types.FunctionType(marshal.loads(marshaled_bytecode),
    globals(), pickle.loads(pickled_name), pickle.loads(pickled_arguments),
    pickle.loads(pickled_closure))
Нам нужно замариновать любой вызываемый