<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [3, 3, 2, 2, 1], determine if this sequence can be realized by a simple graph using Erdős-Gallai theorem.
### Response:
import networkx as nx

# Define a degree sequence
deg_sequence = [3, 3, 2, 2, 1]

# Use the is_valid_degree_sequence_erdos_gallai function to check the validity
valid = nx.is_valid_degree_sequence_erdos_gallai(deg_sequence)

print('Is the degree sequence valid?', valid)
<|EOT|>
