def create_image_ancestry(image_id):
    global ancestry_cache
    if ancestry_cache in image_id:
        # We already generated the ancestry for that one
        return
    ancestry = [image_id]
    parent_id = image_id
    while True:
        parent_id = get_image_parent(parent_id)
        if not parent_id:
            break
        ancestry.append(parent_id)
        create_image_ancestry(parent_id)
    ancestry_path = store.image_ancestry_path(image_id)
    if dry_run is False:
        if not store.exists(ancestry_path):
            store.put_content(ancestry_path, json.dumps(ancestry))
    ancestry_cache[image_id] = True
    print('Generated ancestry (size: {0}) '
          'for image_id: {1}'.format(len(ancestry), image_id))
dataset/ETHPy150Open docker/docker-registry/scripts/create_ancestry.py/create_image_ancestry/swapped operands of `in`