import struct


def read_uint32(buffer: bytearray) -> int:
    """ Read an unsigned 32-bit integer, read bytes are consumed.
    """
    res, = struct.unpack('<I', buffer[:4])
    del buffer[:4]
    return res