def _check_electrification_scenarios_for_partition(es):
    """Checks the electrification scenario input to
    :py:func:`partition_demand_by_sector` and
    :py:func:`partition_flexibility_by_sector`.

    :param str es: The input electrification scenario that will be checked. Can be any
        of: *'Reference'*, *'Medium'*, or *'High'*.
    :return: (*str*) -- The formatted electrification scenario.
    :raises TypeError: if es is not input as a str.
    :raises ValueError: if es is not valid.
    """

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

    # Reformat es
    es = es.capitalize()

    # Check that es is valid
    if es not in {"Reference", "Medium", "High"}:
        raise ValueError(f"{es} is not a valid electrification scenario.")

    # Return the reformatted es
    return es