def get_real_method(obj, name):
 if inspect.isclass(obj):
  return None
 try:
  canary = getattr(obj, '_ipython_canary_method_should_not_exist_', None)
 except Exception:
  return None
 if (canary is not None):
  return None
 try:
  m = getattr(obj, name, None)
 except Exception:
  return None
 if callable(m):
  return m
 return None

def get_real_method ( obj , name ) : if inspect . isclass ( obj ) : return None try : canary = getattr ( obj , '_ipython_canary_method_should_not_exist_' , None ) except Exception : return None if ( canary is not None ) : return None try : m = getattr ( obj , name , None ) except Exception : return None if callable ( m ) : return m return None
like getattr .