def is_open_quote(sql):
 parsed = sqlparse.parse(sql)
 return any((_parsed_is_open_quote(p) for p in parsed))

def is_open_quote ( sql ) : parsed = sqlparse . parse ( sql ) return any ( ( _parsed_is_open_quote ( p ) for p in parsed ) )
returns true if the query contains an unclosed quote .