def lindex(self, key, index):
        """Emulate lindex."""

        redis_list = self._get_list(key, 'LINDEX')

        if self._encode(key) not in self.redis:
            return None

        try:
            return redis_list[index]
        except (IndexError):
            # Redis returns nil if the index doesn't exist
            return None
def lindex ( self , key , index ) : redis_list = self . _get_list ( key , 'LINDEX' ) if self . _encode ( key ) not in self . redis : return None try : return redis_list [ index ] except ( IndexError ) : return None
Emulate lindex.