def interval_to_freq(time_interval: str) ->str:
    """
    Convert the natural language-based time period into freq char in order to
    standardize user input.

    Parameters
    ----------
    time_interval : Natural lanaguage time period.

    Returns
    -------
    freq : Appropriate frequency char, see: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases

    """
    time_interval = time_interval.strip().lower()
    freq = ''
    if time_interval in ['seconds', 'second', 'sec', 's']:
        freq = 'S'
    elif time_interval in ['minutes', 'minute', 'min', 't']:
        freq = 'T'
    elif time_interval in ['hours', 'hour', 'hourly', 'hr', 'h']:
        freq = 'H'
    elif time_interval in ['days', 'day', 'daily', 'd']:
        freq = 'D'
    elif time_interval in ['weeks', 'week', 'weekly', 'w']:
        freq = 'W'
    elif time_interval in ['months', 'month', 'mth', 'm']:
        freq = 'M'
    elif time_interval in ['qtr', 'quarter', 'quar', 'q']:
        freq = 'Q'
    elif time_interval in ['years', 'year', 'annual', 'y', 'a']:
        freq = 'Y'
    else:
        raise ValueError('Parameter time_interval not recognized.')
        return None
    return freq
