def METHOD_NAME(
    metrics: Sequence[PyMetricType],
    session: Optional[tf.compat.v1.Session] = None,
):
  """Execute summary ops for py_metrics.
  Args:
    metrics: A list of py_metric.Base objects.
    session: A TensorFlow session-like object. If it is not provided, it will
      use the current TensorFlow session context manager.
  Raises:
    RuntimeError: If .tf_summaries() was not previously called on any of the
      `metrics`.
    AttributeError: If session is not provided and there is no default session
      provided by a context manager.
  """
  if session is None:
    default_session = tf.compat.v1.get_default_session()
    if default_session is None:
      raise AttributeError(
          'No TensorFlow session-like object was provided, and none '
          "could be retrieved using 'tf.get_default_session()'."
      )
    session = default_session
  for metric in metrics:
    if metric.summary_op is None:
      raise RuntimeError(
          'metric.tf_summaries() must be called on py_metric '
          '{} before attempting to run '
          'summaries.'.format(metric.name)
      )
  summary_ops = [metric.summary_op for metric in metrics]
  feed_dict = dict(
      (metric.summary_placeholder, metric.result()) for metric in metrics
  )
  session.run(summary_ops, feed_dict=feed_dict)