def is_winner(player, board):
    """Returns True if player has three marks in a row."""
    target = [player, player, player]
    winning_lines = (
        [board[i:i + 3] for i in range(0, 7, 3)] +
        [board[i:i + 7:3] for i in range(3)] +
        [[board[0], board[4], board[8]], [board[2], board[4], board[6]]])
    return any(line == target for line in winning_lines)