code: def parse(self, pattern, template, use_format=False):
          
  
          if isinstance(template, bytes):
              self.is_bytes = True
          else:
              self.is_bytes = False
          if isinstance(pattern.pattern, bytes) != self.is_bytes:
              raise TypeError('Pattern string type must match replace template string type!')
          self._original = template
          self.use_format = use_format
          self.parse_template(pattern)
  
          return ReplaceTemplate(
              tuple(self.groups),
              tuple(self.group_slots),
              tuple(self.literals),
              hash(pattern),
              self.use_format,
              self.is_bytes
          )
docs: Parse template.