docs: def sort_dict(dict_, part='keys', key=None, reverse=False):
      """
      sorts a dictionary by its values or its keys
  
      Args:
          dict_ (dict_):  a dictionary
          part (str): specifies to sort by keys or values
          key (Optional[func]): a function that takes specified part
              and returns a sortable value
          reverse (bool): (Defaults to False) - True for descinding order. False
              for ascending order.
  
      Returns:
          OrderedDict: sorted dictionary
  
      CommandLine:
          python -m utool.util_dict sort_dict
  
      Example:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_dict import *  # NOQA
          >>> import utool as ut
          >>> dict_ = {'a': 3, 'c': 2, 'b': 1}
          >>> results = []
          >>> results.append(sort_dict(dict_, 'keys'))
          >>> results.append(sort_dict(dict_, 'vals'))
          >>> results.append(sort_dict(dict_, 'vals', lambda x: -x))
          >>> result = ut.repr4(results)
          >>> print(result)
          [
              {'a': 3, 'b': 1, 'c': 2},
              {'b': 1, 'c': 2, 'a': 3},
              {'a': 3, 'c': 2, 'b': 1},
          ]
      """
      if part == 'keys':
          index = 0
      elif part in {'vals', 'values'}:
          index = 1
      else:
          raise ValueError('Unknown method part=%r' % (part,))
      if key is None:
          _key = op.itemgetter(index)
      else:
          def _key(item):
              return key(item[index])
      sorted_items = sorted(six.iteritems(dict_), key=_key, reverse=reverse)
      sorted_dict = OrderedDict(sorted_items)
      return sorted_dict