def monthCode(month):
    """ 
    perform month->code and back conversion
    
    Input: either month nr (int) or month code (str)
    Returns: code or month nr
    
    """
    codes = 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'Q', 'U', 'V', 'X', 'Z'
    assert month > 0, 'Month number must be positive and >0'
    if isinstance(month, int):
        return codes[month - 1]
    elif isinstance(month, str):
        return codes.index(month) + 1
    else:
        raise ValueError('Function accepts int or str')
