def _reduce_dict(count_dict, partial_key):
 L = len(partial_key)
 count = sum((v for (k, v) in iteritems(count_dict) if (k[:L] == partial_key)))
 return count

def _reduce_dict ( count_dict , partial_key ) : L = len ( partial_key ) count = sum ( ( v for ( k , v ) in iteritems ( count_dict ) if ( k [ : L ] == partial_key ) ) ) return count
make partial sum on a counter dict .