import inspect


def is_instance_method(fun):
    """ Is the callable a bound instance method?

    More reliable than `inspect.ismethod`.
    """
    fun_self = getattr(fun, '__self__', None)
    return fun_self is not None and not inspect.isclass(fun_self) and \
        not inspect.ismodule(fun_self)