code: def withparent(meth):
      """Helper wrapper that passes calls to parent's instance"""
  
      def wrapped(self, *args, **kwargs):
          res = meth(self, *args, **kwargs)
          if getattr(self, "parent", None) is not None:
              getattr(self.parent, meth.__name__)(*args, **kwargs)
          return res
  
      # Unfortunately functools wrapper fails
      # when decorating built-in methods so we
      # need to fix that improper behaviour
      wrapped.__name__ = meth.__name__
      return wrapped
  
imports: import functools
  import warnings
  from typing import Any, Dict, List, NewType, Optional, Sequence, Tuple, Union, cast
  import arviz
  import cloudpickle
  import numpy
  import xarray
  from cachetools import LRUCache, cachedmethod
  from pytensor import Variable
  from pytensor.compile import SharedVariable
  from pytensor.graph.utils import ValidatingScratchpad
  from pymc.exceptions import BlockModelAccessError
label_desc: Use image node_id 1 for calling a global function with example usage: withparent(meth) and returns: wrapped, res