code: def initialize_uninitialized_global_variables(sess):
    
    # List all global variables
    global_vars = tf.global_variables()
  
    # Find initialized status for all variables
    is_var_init = [tf.is_variable_initialized(var) for var in global_vars]
    is_initialized = sess.run(is_var_init)
  
    # List all variables that were not initialized previously
    not_initialized_vars = [var for (var, init) in
                            zip(global_vars, is_initialized) if not init]
  
    # Initialize all uninitialized variables found, if any
    if len(not_initialized_vars):
      sess.run(tf.variables_initializer(not_initialized_vars))
docs: Only initializes the variables of a TensorFlow session that were not
    already initialized.
    :param sess: the TensorFlow session
    :return: