<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [4, 3, 3, 1, 1], how can you construct a simple graph using the Havel-Hakimi algorithm with NetworkX? This code snippet demonstrates the creation of such a graph. The degree sequence indicates the number of connections each node should have. The Havel-Hakimi algorithm will construct a graph satisfying this degree sequence if possible, otherwise, it will raise a NetworkXException indicating that the sequence is not graphical (cannot be represented by a simple graph).
### Response:
import networkx as nx

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

try:
    # Create a graph using Havel-Hakimi algorithm
    G = nx.havel_hakimi_graph(deg_sequence)
    # Draw the graph
    nx.draw(G, with_labels=True)
    plt.show()
except nx.NetworkXException as e:
    print(str(e))
<|EOT|>
