def METHOD_NAME(in_path, out_path, num_processes):
    with open(in_path, "rb") as h:
        uris = filter(None, set(h.read().splitlines()))
        uris = filter(validate_uri, uris)
    clean = []
    ips = []
    # get all uris with an IP addr as hostname
    for uri in uris:
        if filter_ip(uri):
            ips.append(uri)
        else:
            clean.append(uri)
    print("ips: ", len(ips), " nonip: ", len(clean))
    # Look up the IPs of hostnames that look like the IP is encoded in
    # them somehow if that is the case for any of the returne IPs, use
    # the first returned IP
    # get all uris that have a number in them
    check_ip = filter(uri_has_num, clean)
    pool = multiprocessing.Pool(num_processes)
    try:
        pfunc = lookup
        for i, (uri, addrs) in enumerate(pool.imap_unordered(pfunc, check_ip)):
            print("%d/%d " % (i+1, len(check_ip)))
            if not addrs:
                continue
            not_found = 0
            for addr in addrs:
                for num in addr.split('.'):
                    if num not in uri:
                        not_found += 1
                        break
            if not_found == len(addrs):
                continue
            p = urlparse.urlsplit(uri)
            port, hostname = p.port, p.hostname
            l = list(p)
            l[1] = addrs[0] + ((port is not None and (":" + str(port))) or "")
            new_uri = urlparse.urlunsplit(l)
            print(uri, " -> ", new_uri)
            clean.remove(uri)
            clean.append(new_uri)
    finally:
        pool.terminate()
        pool.join()
    # Reverse lookup, if the hostname doesn't include the IP,
    # use it instead of the IP
    pool = multiprocessing.Pool(num_processes)
    try:
        pfunc = reverse_lookup
        for i, (ip_uri, uri) in enumerate(pool.imap_unordered(pfunc, ips)):
            print("%d/%d " % (i+1, len(ips)))
            if uri == ip_uri:
                clean.append(uri)
                continue
            hostname = urlparse.urlsplit(ip_uri).hostname
            for num in hostname.split('.'):
                if num not in uri:
                    print(ip_uri + " -> " + uri)
                    clean.append(uri)
                    break
            else:
                # all ip parts are in the uri, better use the IP only
                # example: http://127.0.0.1.someserver.com/
                try:
                    clean.remove(uri)
                except ValueError:
                    pass
                clean.append(ip_uri)
    finally:
        pool.terminate()
        pool.join()
        print("write %s" % URIS_OUT)
        with open(out_path, "wb") as f:
            lines = sorted(filter(filter_uri, map(fix_uri, set(clean))))
            f.write("\n".join(lines))