code: def parse(self, text, as_html=True):
          
          if not text:
              return text
          entity_text = self.get_text(text)
  
          if self.type == MessageEntityType.BOLD:
              if as_html:
                  return markdown.hbold(entity_text)
              return markdown.bold(entity_text)
          elif self.type == MessageEntityType.ITALIC:
              if as_html:
                  return markdown.hitalic(entity_text)
              return markdown.italic(entity_text)
          elif self.type == MessageEntityType.PRE:
              if as_html:
                  return markdown.hpre(entity_text)
              return markdown.pre(entity_text)
          elif self.type == MessageEntityType.CODE:
              if as_html:
                  return markdown.hcode(entity_text)
              return markdown.code(entity_text)
          elif self.type == MessageEntityType.URL:
              if as_html:
                  return markdown.hlink(entity_text, entity_text)
              return markdown.link(entity_text, entity_text)
          elif self.type == MessageEntityType.TEXT_LINK:
              if as_html:
                  return markdown.hlink(entity_text, self.url)
              return markdown.link(entity_text, self.url)
          elif self.type == MessageEntityType.TEXT_MENTION and self.user:
              return self.user.get_mention(entity_text)
          return entity_text
docs: Get entity value with markup
  
          :param text: original text
          :param as_html: as html?
          :return: entity text with markup