return a tuple (host, job_name) from a url

def _parse_add_url(url):
    """ return a tuple (host, job_name) from a url """
    parsed_url = urlparse(url)
    job_name = None
    paths = parsed_url.path.strip("/").split("/")
    for i, path in enumerate(paths):
        if path == "job" and len(paths) > i:
            job_name = paths[i + 1]
    if job_name is None:
        raise ConfigException("Unable to parse valid job from {0}".format(url))
    return (
        "{0}://{1}".format(parsed_url.scheme, parsed_url.netloc),
        job_name
    )