[python] Write variable to file, including name