code: def escape_string(string):
      
      result = string
      result = result.replace('\\', '\\\\')
      result = result.replace('"', '\\"')
      return '"' + result + '"'
docs: Escape a string for use in Gerrit commands.
  
      :arg str string: The string to escape.
  
      :returns: The string with necessary escapes and surrounding double quotes
          so that it can be passed to any of the Gerrit commands that require
          double-quoted strings.