def _addHook(klass, name, phase, func):
 _enhook(klass, name)
 if (not hasattr(klass, phase(klass, name))):
  setattr(klass, phase(klass, name), [])
 phaselist = getattr(klass, phase(klass, name))
 phaselist.append(func)

def _addHook ( klass , name , phase , func ) : _enhook ( klass , name ) if ( not hasattr ( klass , phase ( klass , name ) ) ) : setattr ( klass , phase ( klass , name ) , [ ] ) phaselist = getattr ( klass , phase ( klass , name ) ) phaselist . append ( func )
adds a hook to a method on a class .