def _return_freq(freq, return_freq_string=False):
    """
    Helper function to return DateOffset object itself or DateOffset alias
    string based on the provided return_freq_string argument.

    :param freq: the input frequency
    :type freq: pandas.DateOffset
    :param return_freq_string:
        If True, return a frequency string; else return pandas.DateOffset.
    :type return_freq_string: boolean

    :return:
        If return_freq_string is True, return a frequency string; else return
        pandas.DateOffset.
    """
    if return_freq_string:
        return freq.freqstr
    else:
        return freq
