code: def labeled_sum(array, labeled, minlength=None):
      """
      sums = labeled_sum(array, labeled, minlength=None)
  
      Labeled sum. sum will be an array of size ``labeled.max() + 1``, where
      ``sum[i]`` is equal to ``np.sum(array[labeled == i])``.
  
      Parameters
      ----------
      array : ndarray of any type
      labeled : int ndarray
          Label map. This is the same type as returned from ``mahotas.label()``
      minlength : int, optional
          Minimum size of return array. If labeled has fewer than ``minlength``
          regions, 0s are added to the result.  (optional)
  
      Returns
      -------
      sums : 1-d ndarray of ``array.dtype``
      """
      labeled = _as_labeled(array, labeled, "labeled_sum")
      maxv = labeled.max() + 1
      if minlength is not None:
          maxv = max(maxv, minlength)
      output = np.empty(maxv, dtype=array.dtype)
      _labeled.labeled_sum(array, labeled, output)
      return output
  
imports: from __future__ import division
  import numpy
  from .morph import get_structuring_elem
  from .None import _labeled
  from .internal import _get_output
  from ._filters import _checked_mode2int
  import mahotas
label_desc: Use image node_id 12 for calling a global function with example usage: labeled_sum(array, labeled, minlength) and returns: output