def __getitem__(self, key):
        """
        Access by integer (row position within result set)
        or by string (value of leftmost column)
        """
        try:
            return list.__getitem__(self, key)
        except TypeError:
            result = [row for row in self if row[0] == key]
            if not result:
                raise KeyError(key)
            if len(result) > 1:
                raise KeyError('%d results for "%s"' % (len(result), key))
            return result[0]
def __getitem__ ( self , key ) : try : return list . __getitem__ ( self , key ) except TypeError : result = [ row for row in self if row [ 0 ] == key ] if not result : raise KeyError ( key ) if len ( result ) > 1 : raise KeyError ( '%d results for "%s"' % ( len ( result ) , key ) ) return result [ 0 ]
Access by integer (row position within result set)
        or by string (value of leftmost column)