from typing import Optional
from typing import Union
from typing import Tuple


def _normalize_keep(keep: Optional[Union[str, Tuple[Optional[str], Optional[str]]]]) -> Tuple[Optional[str], Optional[str]]:
    """Convert a value passed for the 'keep' parameter to a normalized form."""
    if keep is None:
        return (None, None)
    elif isinstance(keep, (str, bytes)):
        if keep == 'first' or keep == 'last':
            return (keep, keep)
        else:
            raise ValueError(f"Unsupported value '{keep}' passed for the `keep` parameter.")
    elif isinstance(keep, tuple):
        if len(keep) == 2:
            return keep
        else:
            raise ValueError(f"Invalid tuple (length={len(keep)}) passed for the `keep` parameter.")
    else:
        raise ValueError(f"Invalid argument value passed for the `keep` parameter.")