code: def escape_chars(text, chars):
      
      text = str(text)
      chars = list(set(chars))
      if '\\' in chars:
          chars.remove('\\')
          chars.insert(0, '\\')
      for ch in chars:
          text = text.replace(ch, '\\' + ch)
      return text
docs: Helper function to escape uncomfortable characters.