code: def invert_dict(dict_, unique_vals=True):
      if unique_vals:
          inverted_items = [(val, key) for key, val in six.iteritems(dict_)]
          inverted_dict = type(dict_)(inverted_items)
      else:
          inverted_dict = group_items(dict_.keys(), dict_.values())
      return inverted_dict