def METHOD_NAME(deptype: DependencyArgument) -> Tuple[str, ...]:
    """Convert deptype to a canonical sorted tuple, or raise ValueError.
    Args:
        deptype: string representing dependency type, or a list/tuple of such strings.
            Can also be the builtin function ``all`` or the string 'all', which result in
            a tuple of all dependency types known to Spack.
    """
    if deptype in ("all", all):
        return all_deptypes
    elif isinstance(deptype, str):
        if deptype not in all_deptypes:
            raise ValueError("Invalid dependency type: %s" % deptype)
        return (deptype,)
    elif isinstance(deptype, (tuple, list, set)):
        bad = [d for d in deptype if d not in all_deptypes]
        if bad:
            raise ValueError("Invalid dependency types: %s" % ",".join(str(t) for t in bad))
        return tuple(sorted(set(deptype)))
    raise ValueError("Invalid dependency type: %s" % repr(deptype))