def escape_quotes_if_needed(string):
if are_quotes_escaped(string):<EOL><INDENT>if string.count("<STR_LIT:'>") != string.count("<STR_LIT>"):<EOL><INDENT>string = string.replace("<STR_LIT:'>", "<STR_LIT>")<EOL><DEDENT>if string.count('<STR_LIT:">') != string.count('<STR_LIT>'):<EOL><INDENT>string = string.replace('<STR_LIT:">', '<STR_LIT>')<EOL><DEDENT><DEDENT>return string<EOL>
re.escape() works differently in Python 3.7.0 than earlier versions:

Python 3.6.5:
>>> import re
>>> re.escape('"')
'\\"'

Python 3.7.0:
>>> import re
>>> re.escape('"')
'"'

SeleniumBase needs quotes to be properly escaped for Javascript calls.