code: def should_generate_summaries():
    
    name_scope = tf.contrib.framework.get_name_scope()
    if name_scope and "while/" in name_scope:
      # Summaries don't work well within tf.while_loop()
      return False
    if tf.get_variable_scope().reuse:
      # Avoid generating separate summaries for different data shards
      return False
    return True
docs: Is this an appropriate context to generate summaries.
  
    Returns:
      a boolean