import struct


def rgb555_to_rgb888(data):
    """
    Converts RGB555 to (vnc-compatible) RGB888
    """
    out = bytearray()

    for b in struct.unpack('<%dH' % (len(data)/2), data):
        out.append(((b) & 0b11111) << 3)
        out.append(((b >> 5) & 0b11111) << 3)
        out.append(((b >> 10) & 0b11111) << 3)
        out.append(0)

    return bytes(out)