code: def group_by_impl(func, sequence):
      
      result = {}
      for element in sequence:
          if result.get(func(element)):
              result.get(func(element)).append(element)
          else:
              result[func(element)] = [element]
      return six.viewitems(result)
docs: Implementation for group_by_t
      :param func: grouping function
      :param sequence: sequence to group
      :return: grouped sequence