def get_ancestors(building):
    ancestors = []
    parents = building.parents.filter(source_type__in=[2, 3, 4])
    ancestors.extend(parents.filter(source_type__in=[2, 3]))
    for p in parents:
        ancestors.extend(get_ancestors(p))
    return ancestors
Saves the sequence to a csv file. Each element should be an iterable which will be expanded
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/models.py/get_ancestors--crossover with--dataset/ETHPy150Open EntilZha/PyFunctional/functional/pipeline.py/Sequence.to_csv