Update flatten.py