from typing import Optional
from typing import Dict


def parent_category(child: Optional[str], categories: Dict[str, Optional[str]]) -> Optional[str]:
    """
    Returns the parent coupon category for a given category. if `child` is
    None or the parent name cannot be found, then None is returned.

    Args:
        child: The category name whose parent needs to be found.
        categories: A dictionary of `{child}:{parent}` representing the parent-child category relationship

    Returns:
        The parent category name of `None` if `child` is `None` or is not in the keys of `categories`
    """
    return categories.get(child, None) if child else None