code: def setcover_greedy(candidate_sets_dict, items=None, set_weights=None, item_values=None, max_weight=None):
      r
      import utool as ut
      solution_cover = {}
      if items is None:
          items = ut.flatten(candidate_sets_dict.values())
      if set_weights is None:
          get_weight = len
      else:
          def get_weight(solution_cover):
              sum([set_weights[key] for key in solution_cover.keys()])
      if item_values is None:
          get_value = len
      else:
          def get_value(vals):
              sum([item_values[v] for v in vals])
      if max_weight is None:
          max_weight = get_weight(candidate_sets_dict)
      avail_covers = {key: set(val) for key, val in candidate_sets_dict.items()}
      while get_weight(solution_cover) < max_weight and len(avail_covers) > 0:
          avail_covers.values()
          uncovered_values = list(map(get_value, avail_covers.values()))
          chosen_idx = ut.argmax(uncovered_values)
          if uncovered_values[chosen_idx] <= 0:
              break
          chosen_key = list(avail_covers.keys())[chosen_idx]
          chosen_set = avail_covers[chosen_key]
          solution_cover[chosen_key] = candidate_sets_dict[chosen_key]
          del avail_covers[chosen_key]
          for vals in avail_covers.values():
              vals.difference_update(chosen_set)
      return solution_cover