code: def _index(*args, **kwargs):
      start = kwargs.pop('start', 0)
      step = kwargs.pop('step', 1)
      if len(args) == 2:
          elem, list_ = args
          ensure_sequence(list_)
          predicate = lambda item: item == elem
      else:
          ensure_keyword_args(kwargs,
                              mandatory=('in_',), optional=('of', 'where'))
          if 'of' in kwargs and 'where' in kwargs:
              raise TypeError(
                  "either an item or predicate must be supplied, not both")
          if not ('of' in kwargs or 'where' in kwargs):
              raise TypeError("an item or predicate must be supplied")
          list_ = ensure_sequence(kwargs['in_'])
          if 'where' in kwargs:
              predicate = ensure_callable(kwargs['where'])
          else:
              elem = kwargs['of']
              predicate = lambda item: item == elem
      len_ = len(list_)
      start = max(0, min(len_ - 1, start))
      i = start
      while 0 <= i < len_:
          if predicate(list_[i]):
              return list_, i
          i += step
      else:
          return list_, -1