def METHOD_NAME(
    workspace_file: StrPath,
    workspace_dir: t.Optional[StrPath] = None,
) -> str:
    """
    Return the real config path or raise an exception.
    If workspace file is directory, scan for .tmuxp.{yaml,yml,json} in directory. If
    one or more found, it will warn and pick the first.
    If workspace file is ".", "./" or None, it will scan current directory.
    If workspace file is has no path and only a filename, e.g. "my_workspace.yaml" it
    will search workspace dir.
    If workspace file has no path and no extension, e.g. "my_workspace", it will scan
    for file name with yaml, yml and json. If multiple exist, it will warn and pick the
    first.
    Parameters
    ----------
    workspace_file : str
        workspace file, valid examples:
        - a file name, my_workspace.yaml
        - relative path, ../my_workspace.yaml or ../project
        - a period, .
    """
    if not workspace_dir:
        workspace_dir = get_workspace_dir()
    path = os.path
    exists, join, isabs = path.exists, path.join, path.isabs
    dirname, normpath, splitext = path.dirname, path.normpath, path.splitext
    cwd = os.getcwd()
    is_name = False
    file_error = None
    workspace_file = os.path.expanduser(workspace_file)
    # if purename, resolve to confg dir
    if is_pure_name(workspace_file):
        is_name = True
    elif (
        not isabs(workspace_file)
        or len(dirname(workspace_file)) > 1
        or workspace_file == "."
        or workspace_file == ""
        or workspace_file == "./"
    ):  # if relative, fill in full path
        workspace_file = normpath(join(cwd, workspace_file))
    # no extension, scan
    if path.isdir(workspace_file) or not splitext(workspace_file)[1]:
        if is_name:
            candidates = [
                x
                for x in [
                    f"{join(workspace_dir, workspace_file)}{ext}"
                    for ext in VALID_WORKSPACE_DIR_FILE_EXTENSIONS
                ]
                if exists(x)
            ]
            if not len(candidates):
                file_error = (
                    "workspace-file not found in workspace dir (yaml/yml/json) %s "
                    "for name" % (workspace_dir)
                )
        else:
            candidates = [
                x
                for x in [
                    join(workspace_file, ext)
                    for ext in [".tmuxp.yaml", ".tmuxp.yml", ".tmuxp.json"]
                ]
                if exists(x)
            ]
            if len(candidates) > 1:
                tmuxp_echo(
                    Fore.RED
                    + "Multiple .tmuxp.{yml,yaml,json} workspace_files in %s"
                    % dirname(workspace_file)
                    + Fore.RESET
                )
                tmuxp_echo(
                    "This is undefined behavior, use only one. "
                    "Use file names e.g. myproject.json, coolproject.yaml. "
                    "You can load them by filename."
                )
            elif not len(candidates):
                file_error = "No tmuxp files found in directory"
        if len(candidates):
            workspace_file = candidates[0]
    elif not exists(workspace_file):
        file_error = "file not found"
    if file_error:
        raise FileNotFoundError(file_error, workspace_file)
    return workspace_file