import struct


def _checksum(block: bytes) -> bytes:
  """Compute add-and-shift-left-1 16-bit big-endian checksum."""
  checksum = 0
  for i in range(0, len(block), 2):
    w = struct.unpack_from('>H', block, i)[0]  # Collect next word
    checksum = (checksum + w) & 0xffff         # Add word to checksum
    checksum = ((checksum << 1) + (checksum >> 15)) & 0xffff  # Rotate left by 1
  return struct.pack('>H', (0x10000 - checksum) & 0xffff)  # Complement