code: def format_mentions(text, format_callback=format_mention):
      
  
      def handle_mention(match):
          name, url = match.groups()
          return format_callback(name, url)
  
      return mention_re.sub(handle_mention, text)
docs: Searches the given text for mentions generated by `expand_mention()` and returns a human-readable form.
  
      For example:
      "@<bob http://example.org/twtxt.txt>" will result in "@bob"
  
      If you follow a source: source.nick will be bold
      If you are the mentioned source: source.nick will be bold and coloured
      If nothing from the above is true: nick will be unstyled
      If nothing from the above is true and nick is not given: url will be used