code: def serialize_function(func):
      """Serializes function for Keras.
  
      (De)serializing Python functions from/to bytecode is unsafe. Therefore we
      return the function's type as an anonymous function ('lambda') or named
      function in the Python environment ('function'). In the latter case, this lets
      us use the Python scope to obtain the function rather than reload it from
      bytecode. (Note that both cases are brittle!)
  
      This serialization mimicks the implementation in `tf_keras.layers.Lambda`.
  
      Args:
        func: Python function to serialize.
  
      Returns:
        (serial, function_type): Serialized object, which is a tuple of its
        bytecode (if function is anonymous) or name (if function is named), and its
        function type.
      """
      if isinstance(func, types.LambdaType):
          return _func_dump(func), "lambda"
      return func.__name__, "function"
  
file_path: probability/tensorflow_probability/python/layers/util.py
imports: import binascii
  import codecs
  import marshal
  import os
  import types
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python import util
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 5 for calling a global function with example usage: serialize_function(func) and returns: func,  str, _func_dump,  str