<｜begin▁of▁sentence｜>### Instruction:
Given a simple, connected, undirected bipartite graph with bipartition nodes ['A', 'B', 'C', 'D'] and [1, 2, 3, 4], and edges [('A', 1), ('B', 2), ('C', 3), ('D', 4), ('A', 2), ('B', 3), ('C', 4), ('D', 1)], can you compute its extendability using NetworkX?
### Response:
import networkx as nx
from networkx.algorithms.bipartite.matching import maximal_extendability

# Create a bipartite graph with a perfect matching
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', 2), ('C', 3), ('D', 4),
                ('A', 2), ('B', 3), ('C', 4), ('D', 1)])

# Compute the extendability of the graph
extendability = maximal_extendability(B)
print('Extendability:', extendability)
<|EOT|>
