h2o-py/h2o/utils/debugging.py
def _get_method_full_name(func):
    """
    Return fully qualified function name.

    This method will attempt to find "full name" of the given function object. This full name is either of
    the form "<class name>.<method name>" if the function is a class method, or "<module name>.<func name>"
    if it's a regular function. Thus, this is an attempt to back-port func.__qualname__ to Python 2.

    :param func: a function object.

    :returns: string with the function's full name as explained above.
    """
    # Python 3.3 already has this information available...
    if hasattr(func, "__qualname__"): return func.__qualname__

    module = inspect.getmodule(func)
    if module is None:
        return "?.%s" % getattr(func, "__name__", "?")
    for cls_name in dir(module):
        cls = getattr(module, cls_name)
        if not inspect.isclass(cls): continue
        for method_name in dir(cls):
            cls_method = getattr(cls, method_name)
            if cls_method == func:
                return "%s.%s" % (cls_name, method_name)
    if hasattr(func, "__name__"):
        return "%s.%s" % (module.__name__, func.__name__)
    return "<unknown>"
def _get_method_full_name(func):
    """
    Return fully qualified function name.

    This method will attempt to find "full name" of the given function object. This full name is either of
    the form "<class name>.<method name>" if the function is a class method, or "<module name>.<func name>"
    if it's a regular function. Thus, this is an attempt to back-port func.__qualname__ to Python 2.

    :param func: a function object.

    :returns: string with the function's full name as explained above.
    """
    # Python 3.3 already has this information available...
    if hasattr(func, "__qualname__"): return func.__qualname__

    module = inspect.getmodule(func)
    if module is None:
        return "?.%s" % getattr(func, "__name__", "?")
    for cls_name in dir(module):
        cls = getattr(module, cls_name)
        if not inspect.isclass(cls): continue
        for method_name in dir(cls):
            cls_method = getattr(cls, method_name)
            if cls_method == func:
                return "%s.%s" % (cls_name, method_name)
    if hasattr(func, "__name__"):
        return "%s.%s" % (module.__name__, func.__name__)
    return "<unknown>"
Return fully qualified function name.

    This method will attempt to find "full name" of the given function object. This full name is either of
    the form "<class name>.<method name>" if the function is a class method, or "<module name>.<func name>"
    if it's a regular function. Thus, this is an attempt to back-port func.__qualname__ to Python 2.

    :param func: a function object.

    :returns: string with the function's full name as explained above.