code: def sum_entries(hist, default: bool = True):
      """Recursively get sum of entries of histogram
  
      Sometimes hist.entries gives zero as answer? This function always works though.
  
      :param hist: input histogrammar histogram
      :param bool default: if false, do not use default HG method for evaluating entries, but exclude nans, of, uf.
      :return: total sum of entries of histogram
      :rtype: int
      """
      if default:
          entries = hist.entries
          if entries > 0:
              return entries
  
      # double check number of entries, sometimes not well set
      if hasattr(hist, "bins"):
          # loop over all counters and integrate over y (=j)
          return sum(sum_entries(bi) for bi in hist.bins.values())
      elif hasattr(hist, "values"):
          # loop over all counters and integrate over y (=j)
          return sum(sum_entries(bi) for bi in hist.values)
      elif hasattr(hist, "entries"):
          # only count histogrammar.Count() objects
          return hist.entries
      else:
          raise TypeError(
              "histogram should have attribute 'bins', 'values' or 'entries'."
          )
  
file_path: popmon/popmon/hist/hist_utils.py
imports: import histogrammar
  import histogrammar.specialized
  import numpy
  import pandas
  from histogrammar.specialized import CategorizeHistogramMethods, HistogramMethods, SparselyHistogramMethods, SparselyTwoDimensionallyHistogramMethods, TwoDimensionallyHistogramMethods
  from histogrammar.util import get_hist_props
label_desc: Use image node_id 1 for calling a global function with example usage: sum_entries(hist, default) and returns: sum, entries, sum, hist