def unbound_method_to_callable(func_or_cls):
 if (isinstance(func_or_cls, types.MethodType) and (not func_or_cls.__self__)):
  return func_or_cls.__func__
 else:
  return func_or_cls

def unbound_method_to_callable ( func_or_cls ) : if ( isinstance ( func_or_cls , types . MethodType ) and ( not func_or_cls . __self__ ) ) : return func_or_cls . __func__ else : return func_or_cls
adjust the incoming callable such that a self argument is not required .