<｜begin▁of▁sentence｜>### Instruction:
Given a set of items with weights {'apple': 10, 'banana': 1, 'cherry': 5}, how can we use NetworkX to select 2 items randomly without replacement such that the probability of selecting each item is proportional to its weight?
### Response:
import networkx as nx
from networkx.utils import random_weighted_sample

# Define the weighted items as a dictionary
items_with_weights = {'apple': 10, 'banana': 1, 'cherry': 5}

# Choose 2 items without replacement based on the weights
sample = random_weighted_sample(items_with_weights, 2)
print(sample)
<|EOT|>
