from datetime import datetime


def get_month_number(month):
    """
    Get the month in numeric format or 'all'

    Parameters
    ----------
    month : int or str

    Returns
    -------
    n_month : int or 'all'
        Month in numeric format, or string 'all'
    """

    if isinstance(month, str):
        if month == 'current':
            n_month = datetime.today().month
        elif month == '':
            n_month = 'all'
        else:
            if len(month) == 3:
                n_month = datetime.strptime(month, '%b').month
            else:
                try:
                    n_month = datetime.strptime(month, '%B').month
                except ValueError:
                    print('Wrong month: {0}'.format(month))
                    raise
    elif isinstance(month, int):
        if not (0 < month < 13):
            raise ValueError('Wrong month: {0}'.format(month))
        else:
            n_month = month
    else:
        raise ValueError('Wrong month: {0}'.format(month))

    return n_month