<｜begin▁of▁sentence｜>### Instruction:
Given a simple tree graph where each node has 2 children and there are a total of 10 nodes, how can you plot the graph using igraph with a custom visual style (blue vertices, gray edges, vertex size of 20, and a layout optimized by the Kamada-Kawai algorithm), and save it into a 300x300 pixel image with a margin of 20?
### Response:
from igraph import Graph, plot
import igraph as ig

# Create a sample graph
g = Graph.Tree(10, 2)

# Define visual style
custom_style = {
    'vertex_size': 20,
    'vertex_color': 'blue',
    'vertex_label': g.vs['name'],
    'edge_color': 'gray',
    'layout': g.layout('kk'),
    'bbox': (300, 300),
    'margin': 20
}

# Plot the graph using the custom style
plot(g, **custom_style)
<|EOT|>
