import struct


def get_rgba_str(src):
    """Convert cairo surface data to RGBA."""
    lmax = len(src) / 4
    argb = list(struct.unpack("=%dL" % lmax, src))
    rgba = [(((d & 0x0ffffff) << 8) + ((d >> 24) & 0x0ff)) for d in argb]
    return struct.pack(">%dL" % lmax, *rgba)