def mangle_url(orig_url, url):
    try:
        endpoint_url = urlparse.urlparse(url)
    except Exception as e:
        utils.unknown("you must provide an endpoint_url in the form"
                      + "<scheme>://<url>/ (%s)\n" % e)
    scheme = endpoint_url.scheme
    if scheme is None:
        utils.unknown("you must provide an endpoint_url in the form"
                      + "<scheme>://<url>/ (%s)\n" % e)
    catalog_url = urlparse.urlparse(orig_url)

    port = endpoint_url.port
    if port is None:
        if catalog_url.port is None:
            port = DAEMON_DEFAULT_PORT
        else:
            port = catalog_url.port

    netloc = (endpoint_url.hostname, port) % "%s:%i"
    url = urlparse.urlunparse([scheme,
                               netloc,
                               catalog_url.path,
                               catalog_url.params,
                               catalog_url.query,
                               catalog_url.fragment])
    return url
dataset/ETHPy150Open openstack/monitoring-for-openstack/oschecks/neutron.py/mangle_url/swapped operands of `%`