docs: def parse(self, text):
          '''Return a string with markup tags converted to ansi-escape sequences.'''
          tags, results = [], []
  
          text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)
  
          if self.strict and tags:
              markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.tag_sep[1])
              raise MismatchedTag('opening tag "%s" has no corresponding closing tag' % markup)
  
          if self.always_reset:
              if not text.endswith(Style.RESET_ALL):
                  text += Style.RESET_ALL
  
          return text