from bs4 import BeautifulSoup


def cur_game_status(doc):
    """
    Return the game status

    :param doc: Html text

    :return: String -> one of ['Final', 'Intermission', 'Progress']
    """
    soup = BeautifulSoup(doc, "lxml")
    tables = soup.find_all('table', {'id': "GameInfo"})
    tds = tables[0].find_all('td')
    status = tds[-1].text

    # 'End' - in there means an Intermission
    # 'Final' - Game is over
    # Otherwise - It's either in progress or b4 the game started
    if 'end' in status.lower():
        return 'Intermission'
    elif 'final' in status.lower():
        return 'Final'
    else:
        return 'Live'