<｜begin▁of▁sentence｜>### Instruction:
Imagine you're developing a smart contract for a decentralized marketplace where we have a set of service providers categorized under 'A', 'B', 'C', 'D' and a group of clients labelled as 1, 2, 3. Each provider offers a distinct service to a client at a certain cost, forming a bipartite relationship between the two sets. The transactions' costs are encapsulated in a weighted graph with edges and assigned rates as follows: {'A' offers to '1' at a cost of 3 Ether}, {'B' to '1' at 2 Ether}, {'C' to '2' at 4 Ether}, and {'D' to '3' at 1 Ether}. 

Using NetworkX within an Ethereum-based application, could you devise a smart contract function that determines the least expensive combination of service providers to clients, ensuring that each client has exactly one service provider associated with it? This optimal pairing would ensure a cost-effective solution that maintains the integrity of the marketplace while maximizing efficiency across the blockchain network.
### Response:
import networkx as nx
from networkx.algorithms.bipartite.matching import minimum_weight_full_matching

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

# Compute the minimum weight full matching
matching = minimum_weight_full_matching(B, top_nodes=['A', 'B', 'C', 'D'])
print(f'Minimum weight full matching: {matching}')
<|EOT|>
