pipeline.py: copied from other project