def month_to_quarter(month_num):
    """Convert the month, provided as an int, to a yearly quarter, also an int.

    Args:
        month_num (int): The month number to convert (1-12)

    Returns:
        int: The quarter this month is in

    Examples:
        >>> month_to_quarter(1)
        1
        >>> month_to_quarter(9)
        3
    """

    try:
        month_num = int(month_num)
        if month_num < 1 or month_num > 12:
            raise Exception
    except:
        raise ValueError("month_num must be an int between 1 and 12, not {!r}"
                         .format(month_num))
    quarter = ((month_num - 1) // 3) + 1

    return quarter