code: def random_weighted_sample(mapping, k, seed=None):
      """Returns k items without replacement from a weighted sample.
  
      The input is a dictionary of items with weights as values.
      """
      if k > len(mapping):
          raise ValueError("sample larger than population")
      sample = set()
      while len(sample) < k:
          sample.add(weighted_choice(mapping, seed))
      return list(sample)
  
file_path: networkx/networkx/utils/random_sequence.py
imports: import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 5 for calling a global function with example usage: random_weighted_sample(mapping, k, seed) and returns: list