import struct


def _replace_header_size(raw_header: bytes, header_size: int) -> bytes:
    """Replace the 'header_size' field in a raw header."""
    header_size_bytes = struct.pack("<I", header_size)
    return raw_header[: 8 + 4] + header_size_bytes + raw_header[8 + 4 + 4 :]