code: def reduce_by_key_impl(func, sequence):
      
      result = {}
      for key, value in sequence:
          if key in result:
              result[key] = func(result[key], value)
          else:
              result[key] = value
      return six.viewitems(result)
docs: Implementation for reduce_by_key_t
      :param func: reduce function
      :param sequence: sequence to reduce
      :return: reduced sequence