import builtins
from typing import Optional
from typing import Tuple
from typing import Any


def tuple(
    env_var: builtins.str,
    default: Optional[Tuple[Any, ...]] = None,
) -> Optional[Tuple[Any, ...]]:
    """
    Parse environment variable value into a tuple.

    Args:
        env_var (str): Name of desired environment variable.
        default (tuple, optional): Optional fallback value.

    Returns:
        tuple (optional): Environment variable typecast into a tuple.

    """
    if env_var == "":
        return default

    return builtins.tuple(env_var.split(","))