code: def _sed_esc(string, escape_all=False):
      '''
      Escape single quotes and forward slashes
      '''
      special_chars = "^.[$()|*+?{"
      string = string.replace("'", "'\"'\"'").replace("/", "\\/")
      if escape_all is True:
          for char in special_chars:
              string = string.replace(char, "\\" + char)
      return strinf _sed_esc(string, escape_all=False):
      '''
      Escape single quotes and forward slashes
      '''
      special_chars = "^.[$()|*+?{"
      string = string.replace("'", "'\"'\"'").replace("/", "\\/")
      if escape_all is True:
          for char in special_chars:
              string = string.replace(char, "\\" + char)
      return string
docs: Escape single quotes and forward slashes