code: def compile(pattern, flags=0, auto_compile=None, **kwargs):  # noqa A001
      
  
      if isinstance(pattern, Bregex):
          if auto_compile is not None:
              raise ValueError("Cannot compile Bregex with a different auto_compile!")
          elif flags != 0:
              raise ValueError("Cannot process flags argument with a compiled pattern")
          return pattern
      else:
          if auto_compile is None:
              auto_compile = True
  
          return Bregex(compile_search(pattern, flags, **kwargs), auto_compile)
docs: Compile both the search or search and replace into one object.