def _watch_callback(obj_weakref, method_name, *args, **kwargs):
 obj = obj_weakref()
 if (obj is None):
  return
 getattr(obj, method_name)(*args, **kwargs)

def _watch_callback ( obj_weakref , method_name , * args , ** kwargs ) : obj = obj_weakref ( ) if ( obj is None ) : return getattr ( obj , method_name ) ( * args , ** kwargs )
a callback handler for the controlconnection that tolerates weak references .