code: def _wrap_and_add_to_tree(clazz, child_func):
      if inspect.isclass(clazz):
  
          class Wrapper(MetricTree):
              __doc__ = clazz.__doc__
  
              def __init__(self, *args, **kwargs):
                  inner = clazz(*args, **kwargs)
                  if isinstance(inner, MetricTree):
                      super(Wrapper, self).__init__(inner.root)
                      self.children = inner.children
                  else:
                      super(Wrapper, self).__init__(inner)
  
                  self.add_child(child_func(self.root))
  
          Wrapper.__name__ = clazz.__name__
          return Wrapper
      else:
          inner = clazz
          if not isinstance(inner, MetricTree):
              inner = MetricTree(inner)
          inner.add_child(child_func(inner))
          return inner
  
file_path: torchbearer/torchbearer/metrics/decorators.py
imports: import inspect
  from torchbearer.metrics import EpochLambda, BatchLambda, ToDict, Mean, MetricTree, Std, Var, RunningMean
  from .metrics import add_default
label_desc: Use image node_id 4 for calling a global function with example usage: _wrap_and_add_to_tree(clazz, child_func) and returns: Wrapper, inner