def normalize_sql_str(string):
  """Normalizes the format of a SQL string for string comparison."""
  string = string.lower()
  while '  ' in string:
    string = string.replace('  ', ' ')
  string = string.strip()
  string = string.replace('( ', '(').replace(' )', ')')
  string = string.replace(' ;', ';')
  string = string.replace('"', '\'')

  if ';' not in string:
    string += ';'
  return string
Normalizes the format of a SQL string for string comparison.
language/xsp/evaluation/official_evaluation.py