import struct


def get_uint(bytearray_: bytearray, byte_index: int) -> int:
    """Get uint value from bytearray.
    Notes:
        Datatype `uint` in the PLC is represented in two bytes
    Args:
        bytearray_: buffer to read from.
        byte_index: byte index to start reading from.
    Returns:
        Int value.
    """
    data = bytearray_[byte_index:byte_index + 2]
    data[1] = data[1] & 0xff
    data[0] = data[0] & 0xff
    packed = struct.pack('2B', *data)
    value = struct.unpack('>H', packed)[0]
    return value