def calculate_degree_days(temperature_equivalent, base_temperature, cooling=False):
    """
    Calculates degree days, starting with a series of temperature equivalent values

    Parameters
    ----------
    temperature_equivalent : Pandas Series
    base_temperature : float
    cooling : bool
        Set True if you want cooling degree days instead of heating degree days

    Returns
    -------
    Pandas Series
    """

    if cooling:
        ret = temperature_equivalent - base_temperature
    else:
        ret = base_temperature - temperature_equivalent

    # degree days cannot be negative
    ret[ret < 0] = 0

    prefix = 'cooling' if cooling else 'heating'
    ret.name = '{}_degree_days_{}'.format(prefix, base_temperature)

    return ret