def vpn(base, prefer, approx, includes=None, excludes=None):
    """
    Generate networks for VPN route table.
    """
    def load_networks(path_arr):
        if path_arr:
            ret = IPSet()
            for path in path_arr.split(','):
                ret |= networks_from_source(open(path, 'rb').read())
            return ret

    must_include = load_networks(includes)
    must_exclude = private_networks()
    if excludes:
        must_exclude |= load_networks(excludes)
    base_networks = china_networks() if base == 'china' else foreign_networks()
    networks = approx_networks(
        base_networks,
        prefer == 'include',
        approx,
        must_include,
        must_exclude
    )
    print '\n'.join(map(str, networks.iter_cidrs()))
def foreign():
    """Query about the foreign networks."""
    networks = foreign_networks()
    print '\n'.join(map(str, networks.iter_cidrs()))