def format_month(month):
    """Formats a month to first 3 characters of the month input

    Args:
        month: user input month
    Returns:
        A ValueError if the input is not a month, or a 3 character month.
    """
    months = ['Jan','Feb','Mar','Apr','May','Jun',
              'Jul','Aug','Sep','Oct','Nov','Dec']
    if (month.isdigit()):
        if(len(month) > 2):
            raise ValueError
        else:
            month = int(month)
            if((month > 12) | (month <= 0)): raise ValueError
            return months[month - 1]
    elif not(month.istitle() | month.islower()| month.isupper()):
        raise ValueError
    elif(month.capitalize() in months):
        return month.capitalize()
    else:
        raise ValueError