def make_urls_hyperlinks(text: str) -> str:
    """
    Adds hyperlinks to text that appears to contain URLs.

    See

    - http://stackoverflow.com/questions/1071191

      - ... except that double-replaces everything; e.g. try with
        ``text = "me@somewhere.com me@somewhere.com"``

    - http://stackp.online.fr/?p=19
    """
    find_url = r'''
        (?x)(              # verbose identify URLs within text
        (http|ftp|gopher)  # make sure we find a resource type
        ://                # ...needs to be followed by colon-slash-slash
        (\w+[:.]?){2,}     # at least two domain groups, e.g. (gnosis.)(cx)
        (/?|               # could be just the domain name (maybe w/ slash)
        [^ \n\r"]+         # or stuff then space, newline, tab, quote
        [\w/])             # resource name ends in alphanumeric or slash
        (?=[\s\.,>)'"\]])  # assert: followed by white or clause ending
        )                  # end of match group
    '''
    replace_url = r'<a href="\1">\1</a>'
    find_email = re.compile(r'([.\w\-]+@(\w[\w\-]+\.)+[\w\-]+)')
    # '.' doesn't need escaping inside square brackets
    # https://stackoverflow.com/questions/10397968/escape-dot-in-a-regex-range
    replace_email = r'<a href="mailto:\1">\1</a>'
    text = re.sub(find_url, replace_url, text)
    text = re.sub(find_email, replace_email, text)
    return text
Adds hyperlinks to text that appears to contain URLs.

    See

    - http://stackoverflow.com/questions/1071191

      - ... except that double-replaces everything; e.g. try with
        ``text = "me@somewhere.com me@somewhere.com"``

    - http://stackp.online.fr/?p=19