import struct


def write_body_array(*items):
    """
    Write a collection of items in struct format for packet body tuple.

    :param items: Collection of items
    :return: Struct formatted
    """
    fmt = 'i%ds'
    body_fmt = "!"
    body_array = []

    # Build format
    for item in items:
        item_fmt = fmt % len(item)
        body_fmt += item_fmt
        body_array.append(len(item))
        body_array.append(item)

    return struct.pack(body_fmt, *body_array)