def _check_technology_advancements_for_partition(ta):
    """Checks the technology advancment input to :py:func:`partition_demand_by_sector`
    and :py:func:`partition_flexibility_by_sector`.

    :param str ta: The input technology advancement that will be checked. Can be any of:
        *'Slow'*, *'Moderate'*, or *'Rapid'*.
    :return: (*str*) -- The formatted technology advancement.
    :raises TypeError: if ta is not input as a str.
    :raises ValueError: if ta is not valid.
    """

    # Check that the input is of an appropriate type
    if not isinstance(ta, str):
        raise TypeError("Technology advancement must be input as a str.")

    # Reformat ta
    ta = ta.capitalize()

    # Check that ta is valid
    if ta not in {"Slow", "Moderate", "Rapid"}:
        raise ValueError(f"{ta} is not a valid technology advancement.")

    # Return the reformatted ta
    return ta