def __getitem__(self, k):
        if isinstance(k, types.IntType):
            if k == -1: # HAVE TO HANDLE THIS CASE SPECIALLY
                k = slice(k, None, 1) # -1 IS LAST LETTER, SO [-1:None] slice
            else: # REGULAR CASE, JUST [k:k+1] slice
                k = slice(k, k + 1, 1)
        if isinstance(k, types.SliceType): # GET AN INTERVAL USING slice
            return self.classySlice(self, k.start, k.stop, k.step)
        elif isinstance(k, SeqPath): # MODEL SEQ AS GRAPH
            if k.path is not self.path:
                raise KeyError('node is not in this sequence!')
            try:
                target = self.classySlice(self.path, k.stop,
                                          k.stop + len(k) * k.step, k.step)
                return {target: LetterEdge(k, target)}
            except __HOLE__: # OUT OF BOUNDS, SO NO NEXT NODE
                return {}
        raise KeyError('requires a slice object or integer key')
dataset/ETHPy150Open cjlee112/pygr/pygr/sequence.py/SeqPath.__getitem__