Replace a password part of a URL with *****.

    This can be used to scrub URLs before logging them.

def hide_url_password(url):
    """Replace a password part of a URL with *****.

    This can be used to scrub URLs before logging them.
    """
    try:
        parsed = parse.urlsplit(url)
        if parsed.password:
            return url.replace(':%s@' % parsed.password, ':*****@')
    except Exception:  # pylint: disable=W0703
        pass
    return url