code: def argsort2(indexable, key=None, reverse=False):
      
      # Create an iterator of value/key pairs
      if isinstance(indexable, dict):
          vk_iter = ((v, k) for k, v in indexable.items())
      else:
          vk_iter = ((v, k) for k, v in enumerate(indexable))
      # Sort by values and extract the keys
      if key is None:
          indices = [k for v, k in sorted(vk_iter, reverse=reverse)]
      else:
          indices = [k for v, k in sorted(vk_iter, key=lambda vk: key(vk[0]),
                                          reverse=reverse)]
      return indices
docs: Returns the indices that would sort a indexable object.
  
      This is similar to np.argsort, but it is written in pure python and works
      on both lists and dictionaries.
  
      Args:
          indexable (list or dict): indexable to sort by
  
      Returns:
          list: indices: list of indices such that sorts the indexable
  
      Example:
          >>> # DISABLE_DOCTEST
          >>> import utool as ut
          >>> # argsort works on dicts
          >>> dict_ = indexable = {'a': 3, 'b': 2, 'c': 100}
          >>> indices = ut.argsort2(indexable)
          >>> assert list(ut.take(dict_, indices)) == sorted(dict_.values())
          >>> # argsort works on lists
          >>> indexable = [100, 2, 432, 10]
          >>> indices = ut.argsort2(indexable)
          >>> assert list(ut.take(indexable, indices)) == sorted(indexable)
          >>> # argsort works on iterators
          >>> indexable = reversed(range(100))
          >>> indices = ut.argsort2(indexable)
          >>> assert indices[0] == 99