def human(n, scale):
    """ Decompose a nonnegative integer `n` into counts by unit from `scale`.

      Parameters:
      * `n`: a nonnegative integer.
      * `scale`: a sequence of `(factor,unit)` where factor is the
        size factor to the follow scale and `unit` is the designator
        of the unit.
  """
    components = []
    for factor, unit in scale:
        if factor == 0:
            components.append((n, unit))
            n = 0
            break
        remainder = n % factor
        components.append((remainder, unit))
        n //= factor
        if n == 0:
            break
    if n > 0:
        raise ValueError('invalid scale, final factor must be 0: %r' % (scale,)
            )
    return components
