Write Function In Python File Handling