code: def _MakeHistogram(values):
      """Convert values into a histogram proto using logic from histogram.cc."""
      limits = _MakeHistogramBuckets()
      counts = [0] * len(limits)
      for v in values:
          idx = bisect.bisect_left(limits, v)
          counts[idx] += 1
  
      limit_counts = [
          (limits[i], counts[i])
          for i in range(len(limits))
          if counts[i]
      ]
      bucket_limit = [lc[0] for lc in limit_counts]
      bucket = [lc[1] for lc in limit_counts]
      sum_sq = sum(v * v for v in values)
      return tf.compat.v1.HistogramProto(
          min=min(values),
          max=max(values),
          num=len(values),
          sum=sum(values),
          sum_squares=sum_sq,
          bucket_limit=bucket_limit,
          bucket=bucket,
      )
  
file_path: tensorboard/tensorboard/scripts/generate_testdata.py
imports: import bisect
  import math
  import os
  import os.path
  import random
  import shutil
  from absl import app
  from absl import flags
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: _MakeHistogram(values) and returns: tf