Python:Write file using with_open_as_out syntax