Refactor snapshot from graph_def into a new method