transform __open_file into a method