code: def _reduce_dict(count_dict, partial_key):
      """
      Make partial sum on a counter dict.
      Given a match for the beginning of the category, it will sum each value.
      """
      L = len(partial_key)
      count = sum(
          v for k, v in count_dict.items() if k[:L] == partial_key
      )
      return count
  
imports: from statsmodels.compat.python import lrange, lzip
  from itertools import product
  import numpy
  from numpy import array, cumsum, iterable, r_
  from pandas import DataFrame
  from statsmodels.graphics import utils
label_desc: Use image node_id 3 for calling a global function with example usage: _reduce_dict(count_dict, partial_key) and returns: count