code: def chunked_join(iterable, int1, int2, str1, str2, func):
      
      chunks = list(chunked(iterable, int1))
      logging.debug(chunks)
      groups = [list(chunked(chunk, int2)) for chunk in chunks]
      logging.debug(groups)
      return str1.join([
          str2.join([func(''.join(chunk)) for chunk in chunks])
          for chunks in groups
      ])
docs: Chunk and join.