def convert_url(url):
    parsed_url = urlparse(url)
    log.debug(repr(parsed_url))
    url_path = parsed_url[2]
    if not url_path:
        # Then we assume it is a fragment.
        new_url = urlunparse(parsed_url)
        new_url = urljoin(PYPI_URL, new_url)
        return new_url
    if (not url_path.endswith(".md") and
        url_path != "LICENSE"):
        return None
    # Otherwise, we link back to the original GitHub pages.
    new_url = urlunparse(parsed_url)
    new_url = urljoin(GITHUB_URL, new_url)
    return new_url
Convert URL appearing in a markdown file to a new URL.
dataset/ETHPy150Open cjerdonek/open-rcv/pandoc_filters/md2rst.py/convert_url