import inspect


def _instance_required(type_, class_, params):
    """Return true if method requires `self` instance."""
    if not params or class_ is None or type_ != 'function':
        return False
    # Check that the first parameter is named "self" to distinguish an
    # unbound method from a dereferenced staticmethod.
    return params[0].name == 'self' and params[0].default == inspect.Parameter.empty