def diff_month(date1, date2):
    """Counts the number of months between two dates

    Args:
        d1 - date to
        d2 - date from
    Returns:
        number of months between two dates
    """

    return (date1.year - date2.year) * 12 + date1.month - date2.month