def winner(board):
    """
    Returns the winner of the game, if there is one.
    """

    winning_combos = [
    (0,1,2), (3,4,5), (6,7,8),
    (0,3,6), (1,4,7), (2,5,8),
    (0,4,8), (2,4,6)
    ]

    for line in winning_combos:
        a, b, c = line
        a, b, c = divmod(a, len(board)), divmod(b, len(board)), divmod(c, len(board))

        if board[a[0]][a[1]]\
        and board[a[0]][a[1]] == board[b[0]][b[1]] and\
        board[b[0]][b[1]] == board[c[0]][c[1]]:
            return board[a[0]][a[1]]