Describe a time you had to optimize a Python-based data pipeline to handle massive datasets efficiently.