def joinLinks(links, sep=', ', last=None, sort=False):
    """Returns a string joining *links* as reStructuredText."""
    links = list(links)
    if sort:
        links.sort()
    if last is None:
        last = ''
    else:
        last = last + '`' + links.pop() + '`_'
    return '`' + ('`_' + sep + '`').join(links) + '`_' + last
