def withparent(meth):
 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
 wrapped.__name__ = meth.__name__
 return wrapped

def withparent ( meth ) : 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 wrapped . __name__ = meth . __name__ return wrapped
helper wrapper that passes calls to parents instance .