def index(self, val, start=None, stop=None):
<EOL>_len = self._len<EOL>if not _len:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(val))<EOL><DEDENT>if start is None:<EOL><INDENT>start = <NUM_LIT:0><EOL><DEDENT>if start < <NUM_LIT:0>:<EOL><INDENT>start += _len<EOL><DEDENT>if start < <NUM_LIT:0>:<EOL><INDENT>start = <NUM_LIT:0><EOL><DEDENT>if stop is None:<EOL><INDENT>stop = _len<EOL><DEDENT>if stop < <NUM_LIT:0>:<EOL><INDENT>stop += _len<EOL><DEDENT>if stop > _len:<EOL><INDENT>stop = _len<EOL><DEDENT>if stop <= start:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(val))<EOL><DEDENT>_maxes = self._maxes<EOL>pos_left = bisect_left(_maxes, val)<EOL>if pos_left == len(_maxes):<EOL><INDENT>raise ValueError('<STR_LIT>'.format(val))<EOL><DEDENT>_lists = self._lists<EOL>idx_left = bisect_left(_lists[pos_left], val)<EOL>if _lists[pos_left][idx_left] != val:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(val))<EOL><DEDENT>stop -= <NUM_LIT:1><EOL>left = self._loc(pos_left, idx_left)<EOL>if start <= left:<EOL><INDENT>if left <= stop:<EOL><INDENT>return left<EOL><DEDENT><DEDENT>else:<EOL><INDENT>right = self._bisect_right(val) - <NUM_LIT:1><EOL>if start <= right:<EOL><INDENT>return start<EOL><DEDENT><DEDENT>raise ValueError('<STR_LIT>'.format(val))<EOL>
Return the smallest *k* such that L[k] == val and i <= k < j`.  Raises
ValueError if *val* is not present.  *stop* defaults to the end of the
list. *start* defaults to the beginning. Negative indices are supported,
as for slice indices.