def _get_real_func(func):
    if inspect.ismethod(func):
        return func.__func__
    else:
        return func
Duplicates some of the logic implicit in inspect.getsource(). Basically
dataset/ETHPy150Open adamchainz/patchy/patchy/api.py/_get_real_func