code: def function_to_serializable_representation(fn):
      
      if type(fn) not in (FunctionType, BuiltinFunctionType):
          raise ValueError(
              "Can't serialize %s : %s, must be globally defined function" % (
                  fn, type(fn),))
  
      if hasattr(fn, "__closure__") and fn.__closure__ is not None:
          raise ValueError("No serializable representation for closure %s" % (fn,))
  
      return {"__module__": get_module_name(fn), "__name__": fn.__name__}
docs: Converts a Python function into a serializable representation. Does not
      currently work for methods or functions with closure data.