code: def pb(scalars_layout):
      """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.
  
      Returns:
        A summary proto containing the layout.
      """
      # TODO(nickfelt): remove on-demand imports once dep situation is fixed.
      import tensorflow.compat.v1 as tf
  
      assert isinstance(scalars_layout, layout_pb2.Layout)
      tensor = tf.make_tensor_proto(
          scalars_layout.SerializeToString(), dtype=tf.string
      )
      tf_summary_metadata = tf.SummaryMetadata.FromString(
          metadata.create_summary_metadata().SerializeToString()
      )
      summary = tf.Summary()
      summary.value.add(
          tag=metadata.CONFIG_SUMMARY_TAG,
          metadata=tf_summary_metadata,
          tensor=tensor,
      )
      return summary
  
imports: from tensorboard.plugins.custom_scalar import layout_pb2
  from tensorboard.plugins.custom_scalar import metadata
label_desc: Use image node_id 2 for calling a global function with example usage: pb(scalars_layout) and returns: summary