code: def maybe_create_multitask_mean_fn(mean_fn, kernel, dtype):
      """Create a default mean function if one is not provided."""
      if mean_fn is not None:
          if not callable(mean_fn):
              raise ValueError("`mean_fn` must be a Python callable")
          return mean_fn
  
      def _mean_fn(x):
          # Shape B1 + [E, N], where E is the number of index points, and N is
          # the number of tasks.
          flat_shapes = tf.nest.flatten(
              tf.nest.map_structure(
                  lambda z, d: ps.shape(z)[:-d], x, kernel.feature_ndims
              )
          )
          bcast_shape = functools.reduce(
              ps.broadcast_shape, flat_shapes, []
          )
          return tf.zeros(
              ps.concat([bcast_shape, [kernel.num_tasks]], axis=0),
              dtype=dtype,
          )
  
      return _mean_fn
  
file_path: probability/tensorflow_probability/python/distributions/internal/stochastic_process_util.py
imports: import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.psd_kernels.internal import util
  from tensorflow.python.util import nest
label_desc: Use image node_id 10 for calling a global function with example usage: maybe_create_multitask_mean_fn(mean_fn, kernel, dtype) and returns: _mean_fn, mean_fn, tf