from typing import Any
from typing import Tuple
from typing import Union


def get_union_args(arg: Any) -> Tuple[Any, ...]:
    """
    Gets the union types of a given argument. If the argument isn't an union, it returns a single element tuple.

    Parameters
    ----------
    arg: Any
        The argument to get the union types of.
    """
    origin = getattr(arg, '__origin__', None)

    if origin is Union:
        args = getattr(arg, '__args__')
        unions = []

        for arg in args:
            unions.extend(get_union_args(arg))

        return tuple(unions)

    elif origin is not None:
        return (origin,)

    return (arg,)