code: def get_aggregate_fn(agg):
      """Internal function to get the aggregation function for node data
      generated from different relations.
  
      Parameters
      ----------
      agg : str
          Method for aggregating node features generated by different relations.
          Allowed values are 'sum', 'max', 'min', 'mean', 'stack'.
  
      Returns
      -------
      callable
          Aggregator function that takes a list of tensors to aggregate
          and returns one aggregated tensor.
      """
      if agg == "sum":
          fn = _sum_reduce_func
      elif agg == "max":
          fn = _max_reduce_func
      elif agg == "min":
          fn = _min_reduce_func
      elif agg == "mean":
          fn = _mean_reduce_func
      elif agg == "stack":
          fn = None  # will not be called
      else:
          raise DGLError(
              "Invalid cross type aggregator. Must be one of "
              '"sum", "max", "min", "mean" or "stack". But got "%s"'
              % agg
          )
      if agg == "stack":
          return _stack_agg_func
      else:
          return partial(_agg_func, fn=fn)
  
imports: from functools import partial
  import torch
  import torch.nn
  from ...base import DGLError
label_desc: Use image node_id 7 for calling a global function with example usage: get_aggregate_fn(agg) and returns: _stack_agg_func, partial