def cachedir_valid(cachedir):
    for i in range(MAX_NODES):
        if (not os.path.isdir(get_datadir_path(cachedir, i))):
            return False
    return (not os.path.exists(os.path.join(get_datadir_path(cachedir, 0), '.incomplete')))
def cachedir_valid(cachedir):
    for i in range(MAX_NODES):
        if (not os.path.isdir(get_datadir_path(cachedir, i))):
            return False
    return (not os.path.exists(os.path.join(get_datadir_path(cachedir, 0), '.incomplete')))