def detect_base_package(App):
    """Detect the base package for an App class

    Will return 'notebook' or 'jupyter_server'
    based on which package App subclasses from.

    Will return None if neither is identified (e.g. fork package, or duck-typing).
    """
    # guess notebook or jupyter_server based on App class inheritance
    for cls in App.mro():
        pkg = cls.__module__.split(".", 1)[0]
        if pkg in {"notebook", "jupyter_server"}:
            return pkg
    return None
Detect the base package for an App class

Will return 'notebook' or 'jupyter_server'
based on which package App subclasses from.

Will return None if neither is identified (e.g. fork package, or duck-typing).
jupyterhub/singleuser/mixins.py