code: def make_function(*, function, name, arity, wrap=True):
      """Make a function node, a representation of a mathematical relationship.
  
      This factory function creates a function node, one of the core nodes in any
      program. The resulting object is able to be called with NumPy vectorized
      arguments and return a resulting vector based on a mathematical
      relationship.
  
      Parameters
      ----------
      function : callable
          A function with signature `function(x1, *args)` that returns a Numpy
          array of the same shape as its arguments.
  
      name : str
          The name for the function as it should be represented in the program
          and its visualizations.
  
      arity : int
          The number of arguments that the `function` takes.
  
      wrap : bool, optional (default=True)
          When running in parallel, pickling of custom functions is not supported
          by Python's default pickler. This option will wrap the function using
          cloudpickle allowing you to pickle your solution, but the evolution may
          run slightly more slowly. If you are running single-threaded in an
          interactive Python session or have no need to save the model, set to
          `False` for faster runs.
  
      """
      if not isinstance(arity, int):
          raise ValueError("arity must be an int, got %s" % type(arity))
      if not isinstance(function, np.ufunc):
          if function.__code__.co_argcount != arity:
              raise ValueError(
                  "arity %d does not match required number of "
                  "function arguments of %d."
                  % (arity, function.__code__.co_argcount)
              )
      if not isinstance(name, str):
          raise ValueError("name must be a string, got %s" % type(name))
      if not isinstance(wrap, bool):
          raise ValueError("wrap must be an bool, got %s" % type(wrap))
  
      # Check output shape
      args = [np.ones(10) for _ in range(arity)]
      try:
          function(*args)
      except (ValueError, TypeError):
          raise ValueError(
              "supplied function %s does not support arity of %d."
              % (name, arity)
          )
      if not hasattr(function(*args), "shape"):
          raise ValueError(
              "supplied function %s does not return a numpy array."
              % name
          )
      if function(*args).shape != (10,):
          raise ValueError(
              "supplied function %s does not return same shape as "
              "input vectors." % name
          )
  
      # Check closure for zero & negative input arguments
      args = [np.zeros(10) for _ in range(arity)]
      if not np.all(np.isfinite(function(*args))):
          raise ValueError(
              "supplied function %s does not have closure against "
              "zeros in argument vectors." % name
          )
      args = [-1 * np.ones(10) for _ in range(arity)]
      if not np.all(np.isfinite(function(*args))):
          raise ValueError(
              "supplied function %s does not have closure against "
              "negatives in argument vectors." % name
          )
  
      if wrap:
          return _Function(
              function=wrap_non_picklable_objects(function),
              name=name,
              arity=arity,
          )
      return _Function(function=function, name=name, arity=arity)
  
file_path: gplearn/gplearn/functions.py
imports: import numpy
  from joblib import wrap_non_picklable_objects
label_desc: Use image node_id 1 for calling a global function with example usage: make_function() and returns: _Function, _Function