import types


def get_function(callable_):
    """If given a method, returns its function object; otherwise a no-op."""
    if isinstance(callable_, types.MethodType):
        return callable_.__func__
    return callable_