conn.escape_string() Veja o mapeamento da função MySQL C API:https://mysql-python.sourceforge.net/MySQLdb. html