<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [4, 3, 3, 2, 2], can you check whether this sequence can be realized by a simple graph using the Erdős-Gallai criterion?
### Response:
import networkx as nx

# Given degree sequence
deg_sequence = [4, 3, 3, 2, 2]

# Check if the degree sequence is valid using Erdős-Gallai theorem
valid = nx.is_valid_degree_sequence_erdos_gallai(deg_sequence)

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