def _convert_years_months_to_days(timedeltas):
    """Converts any 'years' or 'months' values in a given timedeltas dict
    to equivalent values of days and adds them to the 'days' value.
    This is to work around a lack of support for months and years in
    Python's timedelta library.
    Assumes 30 days per month, 365 days per year.
    """
    if 'months' in timedeltas:
        timedeltas['days'] = timedeltas.setdefault('days', 0
            ) + 30 * timedeltas['months']
        del timedeltas['months']
    if 'years' in timedeltas:
        timedeltas['days'] = timedeltas.setdefault('days', 0
            ) + 365 * timedeltas['years']
        del timedeltas['years']
