<｜begin▁of▁sentence｜>### Instruction:
Given a bipartite graph with two sets of nodes {('A', 'B', 'C', 'D')} and {(1, 2, 3, 4)} and edges {('A', 1), ('B', 1), ('C', 2), ('C', 3), ('D', 4)}, how would you use NetworkX to find the maximum cardinality matching?
### Response:
import networkx as nx

# Create a bipartite graph
B = nx.Graph()
B.add_nodes_from(['A', 'B', 'C', 'D'], bipartite=0)
B.add_nodes_from([1, 2, 3, 4], bipartite=1)
B.add_edges_from([('A', 1), ('B', 1), ('C', 2), ('C', 3), ('D', 4)])

# Compute the maximum cardinality matching of the bipartite graph
matching = nx.algorithms.bipartite.matching.hopcroft_karp_matching(B, top_nodes=['A', 'B', 'C', 'D'])
print('The matching is:', matching)
<|EOT|>
