code: def op(scalars_layout, collections=None):
      """Creates a summary that contains a layout.
  
      When users navigate to the custom scalars dashboard, they will see a layout
      based on the proto provided to this function.
  
      Args:
        scalars_layout: The scalars_layout_pb2.Layout proto that specifies the
            layout.
        collections: Optional list of graph collections keys. The new
            summary op is added to these collections. Defaults to
            `[Graph Keys.SUMMARIES]`.
  
      Returns:
        A tensor summary op that writes the layout to disk.
      """
      # TODO(nickfelt): remove on-demand imports once dep situation is fixed.
      import tensorflow.compat.v1 as tf
  
      assert isinstance(scalars_layout, layout_pb2.Layout)
      summary_metadata = metadata.create_summary_metadata()
      return tf.summary.tensor_summary(
          name=metadata.CONFIG_SUMMARY_TAG,
          tensor=tf.constant(
              scalars_layout.SerializeToString(), dtype=tf.string
          ),
          collections=collections,
          summary_metadata=summary_metadata,
      )
  
imports: from tensorboard.plugins.custom_scalar import layout_pb2
  from tensorboard.plugins.custom_scalar import metadata
label_desc: Use image node_id 1 for calling a global function with example usage: op(scalars_layout, collections) and returns: tf