Removed flatten from python as it does not exist there(!)