code: def _escape(self, s):
          
          for ch, r_ch in self.ESCAPE_SETS:
              s = s.replace(ch, r_ch)
          return s
docs: Escape bad characters for regular expressions.
  
          Similar to `re.escape` but allows '%' to pass through.