def write_to_file(filename, data, report=False):
 f = open(filename, 'w')
 try:
  f.write(data)
 finally:
  f.close()
 if report:
  gdb_report(filename)
 return filename

def write_to_file ( filename , data , report = False ) : f = open ( filename , 'w' ) try : f . write ( data ) finally : f . close ( ) if report : gdb_report ( filename ) return filename
write contents to a given file path specified .