code: def escape(pattern):
      "Escape all non-alphanumeric characters in pattern."
      s = list(pattern)
      alphanum = _alphanum
      for i, c in enumerate(pattern):
          if c not in alphanum:
              if c == "\000":
                  s[i] = "\\000"
              else:
                  s[i] = "\\" + c
      return pattern[:0].join(sf escape(pattern):
      "Escape all non-alphanumeric characters in pattern."
      s = list(pattern)
      alphanum = _alphanum
      for i, c in enumerate(pattern):
          if c not in alphanum:
              if c == "\000":
                  s[i] = "\\000"
              else:
                  s[i] = "\\" + c
      return pattern[:0].join(s)
docs: Escape all non-alphanumeric characters in pattern.