code: def escape(arg):
      "escape shell special characters" 
      slash = '\\'
      special = '"$'
  
      arg = arg.replace(slash, slash+slash)
      for c in special:
          arg = arg.replace(c, slash+c)
  
      # print("ESCAPE RESULT: %s" % arg)
      return '"' + arg + '"f escape(arg):
      "escape shell special characters" 
      slash = '\\'
      special = '"$'
  
      arg = arg.replace(slash, slash+slash)
      for c in special:
          arg = arg.replace(c, slash+c)
  
      # print("ESCAPE RESULT: %s" % arg)
      return '"' + arg + '"'
docs: escape shell special characters