Return a timedelta from a dict of date elements.

    Accepts a dict containing any of the following:
      - years
      - months
      - days
      - hours
      - minutes
      - seconds

    If years and/or months are provided, it will use a naive calcuation
    of 365 days in a year and 30 days in a month.

def _timedelta_from_elements(elements):
    """
    Return a timedelta from a dict of date elements.

    Accepts a dict containing any of the following:
      - years
      - months
      - days
      - hours
      - minutes
      - seconds

    If years and/or months are provided, it will use a naive calcuation
    of 365 days in a year and 30 days in a month.
    """
    days = sum((
        elements['days'],
        _months_to_days(elements.get('months', 0)),
        _years_to_days(elements.get('years', 0))
    ))

    return datetime.timedelta(days=days,
                              hours=elements.get('hours', 0),
                              minutes=elements.get('minutes', 0),
                              seconds=elements.get('seconds', 0))