code: def parse(self):
          
  
          self.verbose = bool(self.re_verbose)
          self.unicode = bool(self.re_unicode)
          self.global_flag_swap = {
              "unicode": ((self.re_unicode is not None) if not _util.PY37 else False),
              "verbose": False
          }
          self.temp_global_flag_swap = {
              "unicode": False,
              "verbose": False
          }
          self.ascii = self.re_unicode is not None and not self.re_unicode
          if not self.unicode and not self.ascii:
              self.unicode = True
  
          new_pattern = []
          text = self.process_quotes(self.search.decode('latin-1') if self.is_bytes else self.search)
  
          i = _util.StringIter(text)
          iter(i)
  
          retry = True
          while retry:
              retry = False
              try:
                  new_pattern = self.main_group(i)
              except GlobalRetryException:
                  # Prevent a loop of retry over and over for a pattern like ((?u)(?a))
                  # or (?-x:(?x))
                  if self.temp_global_flag_swap['unicode']:
                      if self.global_flag_swap['unicode']:
                          raise LoopException('Global unicode flag recursion.')
                      else:
                          self.global_flag_swap["unicode"] = True
                  if self.temp_global_flag_swap['verbose']:
                      if self.global_flag_swap['verbose']:
                          raise LoopException('Global verbose flag recursion.')
                      else:
                          self.global_flag_swap['verbose'] = True
                  self.temp_global_flag_swap = {
                      "unicode": False,
                      "verbose": False
                  }
                  i.rewind(i.index)
                  retry = True
  
          return "".join(new_pattern).encode('latin-1') if self.is_bytes else "".join(new_pattern)
docs: Apply search template.