code: def _prepare_pattern(self, pattern):
          
          regex, _, rest = pattern.partition('\\;')
          try:
              return re.compile(regex, re.I)
          except re.error as e:
              warnings.warn(
                  "Caught '{error}' compiling regex: {regex}"
                  .format(error=e, regex=regex)
              )
              # regex that never matches:
              # http://stackoverflow.com/a/1845097/413622
              return re.compile(r'(?!x)x')
docs: Strip out key:value pairs from the pattern and compile the regular
          expression.