code: def get_editor_query(sql):
      
      sql = sql.strip()
  
      # The reason we can't simply do .strip('\e') is that it strips characters,
      # not a substring. So it'll strip "e" in the end of the sql also!
      # Ex: "select * from style\e" -> "select * from styl".
      pattern = re.compile('(^\\\e|\\\e$)')
      while pattern.search(sql):
          sql = pattern.sub('', sql)
  
      return sql
docs: Get the query part of an editor command.