docs: def _index_list(key_or_list, direction=None):
      """Helper to generate a list of (key, direction) pairs.
  
      Takes such a list, or a single key, or a single key and direction.
      """
      if direction is not None:
          return [(key_or_list, direction)]
      else:
          if isinstance(key_or_list, string_type):
              return [(key_or_list, ASCENDING)]
          elif not isinstance(key_or_list, (list, tuple)):
              raise TypeError("if no direction is specified, "
                              "key_or_list must be an instance of list")
          return key_or_list