def METHOD_NAME(obj: object, method_name: str, max_depth: int = -1) -> bool:
    """
    Return True if a caller is being called from a given method of a given
    object.
    Parameters
    ----------
    obj : object
        Check if we are within a method of this object.
    method_name : str
        Check if we are within a method by this name.
    max_depth : int, optional (-1)
        Stop checking stack frames after we have checked this many.
    Returns
    -------
    within : boolean
        True if the calling function is being called from within the method
        given bound to the object given.
    Examples
    --------
    >>> from dffml import within_method
    >>>
    >>> class FirstClass:
    ...     def feedface(self):
    ...         print(within_method(self, "__init__", max_depth=3))
    ...
    >>> first = FirstClass()
    >>> first .feedface()
    False
    >>>
    >>> class SecondClass(FirstClass):
    ...     def __init__(self):
    ...         self.feedface()
    ...
    >>> second = SecondClass()
    True
    >>>
    >>> class ThirdClass(SecondClass):
    ...     def __init__(self):
    ...         self.deadbeef()
    ...
    ...     def deadbeef(self):
    ...         self.feedface()
    ...
    >>> third = ThirdClass()
    False
    """
    # HACK Fix for if we are running in IPython notebook. Sometimes it doesn't
    # patch inspect.findsource as is intended
    # References:
    # - https://github.com/ipython/ipython/issues/1456
    # - https://github.com/ipython/ipython/commit/298fdab5025745cd25f7f48147d8bc4c65be9d4a#diff-3a77d00d5690f670e9ac680f06b8ffe7ca902c6d325673f32e719d8e55b11ae3R209
    global IN_IPYTHON
    global CHECKED_IN_IPYTHON
    global IPYTHON_INSPECT_PATCHED
    if (
        not CHECKED_IN_IPYTHON
        and sys.version_info.major == 3
        and sys.version_info.minor <= 7
    ):
        try:
            get_ipython()
            IN_IPYTHON = True
        except:
            pass
        CHECKED_IN_IPYTHON = True
        if IN_IPYTHON and not IPYTHON_INSPECT_PATCHED:
            import IPython.core.ultratb
            inspect.findsource = IPython.core.ultratb.findsource
            IPYTHON_INSPECT_PATCHED = False
    # Grab stack frames
    try:
        frames = inspect.stack()
    except ImportError:
        # HACK ImportError Fix for lazy_import rasing on autosklearn/smac: emcee
        return True
    for i, frame_info in enumerate(frames):
        if max_depth != -1 and i >= max_depth:
            break
        if (
            frame_info.function == method_name
            and "self" in frame_info.frame.f_locals
            and frame_info.frame.f_locals["self"] is obj
        ):
            return True
    return False