def METHOD_NAME(buffer: io.BytesIO):
    '''
    Read an uint16 image from a buffer
    First, 2 ints are read (height, width) then the endianness symbol and then height * width * 2 bytes.
    The elements are consumed from the buffer.
    returns the image as an np.array
    '''
    image_shape = struct.unpack('>2I', buffer.read(struct.calcsize('>2I')))
    endianness = struct.unpack('c', buffer.read(struct.calcsize('c')))[0].decode('ascii')
    assert endianness in ['>', '<']
    elem_count = prod(image_shape)
    img_bytes = buffer.read(elem_count * 2)
    dt = np.dtype(np.uint16)
    dt = dt.newbyteorder(endianness)
    img = np.frombuffer(img_bytes, dtype=dt, count=elem_count).reshape(image_shape)
    return img