code: def capture_variables(fn):
      """Utility function that captures which tf variables were created by `fn`.
  
      This function encourages style that is easy to write, resonably easy to
      understand but against google codestyle.
  
      In general, you have an function `f` that takes some arguments (`a` and `b`)
      and returns some output. You may enclose it in lambda and get
      `fn == lambda: f(a,b)`, which is a function without arguments that does the
      same as `f`.
  
      This idiom makes variable management much easier and less error prone. Usable
      for prototyping or debugging.
  
      Args:
        fn: function with no arguments.
  
      Returns:
        tuple: First element of this touple is a list of tf variables created by
            fn, second is the actual output of fn
  
      """
      vars_before_fn = tf.trainable_variables()
      fn_return = fn()
      vars_after_fn = tf.trainable_variables()
      fn_vars = list(set(vars_after_fn) - set(vars_before_fn))
      return set(fn_vars), fn_return
  
imports: from __future__ import absolute_import
  from __future__ import division
  import copy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: capture_variables(fn) and returns: set,  fn_return