code: def deepvalues(mapping):
      values = vals_sorted_by_key(mapping)
      for obj in values:
          mapping = False
          try:
              obj.items
          except AttributeError:
              pass
          else:
              mapping = True
              for subobj in deepvalues(obj):
                  yield subobj
          if not mapping:
              yield obj