def METHOD_NAME(self, db_dir: Path):
    """Discover the database name from the given ``db_dir``"""
    from wbia.init.sysres import get_workdir
    db_dir = db_dir.resolve()  # just in case
    work_dir = Path(get_workdir()).resolve()
    # Can we discover the database name?
    # if not db_dir.is_relative_to(workdir):  # >= Python 3.9
    if not str(work_dir) in str(db_dir):
        raise ValueError(
            'Strange circumstances have lead us to a place of '
            f"incongruity where the '{db_dir}' is not within '{work_dir}'"
        )
    # lowercase because database names are case insensitive
    return db_dir.name.lower()