def _is_relative_to(path, prefix):
    """
    Backport Path.is_relative_to for Python < 3.9

    added in Python 3.9
    """
    if hasattr(path, "is_relative_to"):
        # Python >= 3.9
        return path.is_relative_to(prefix)
    else:
        return path == prefix or prefix in path.parents
Backport Path.is_relative_to for Python < 3.9

added in Python 3.9
jupyterhub/singleuser/_disable_user_config.py