from typing import Any
import struct


def pack_into(fmt: str, buffer: bytearray, offset: int, *args: Any) -> int:
    """ Pack data with struct.pack_into and given data format.
        return the size of the output data with that format.
        Use offset += pack_into() to update the offset for next call """
    struct.pack_into(fmt, buffer, offset, *args)
    return struct.calcsize(fmt)