def METHOD_NAME(self, key, data, outsize):
    key = int.from_bytes(key.encode("ascii"), byteorder="big")
    self.asc.iface.writemem(self.shmem, data)
    ret = self.cmd(SMCReadWriteKey(KEY=key, RSIZE=outsize, WSIZE=len(data)))
    if outsize <= 4:
        return struct.pack("<I", ret.VALUE)[:outsize]
    else:
        return self.asc.iface.readmem(self.shmem, ret.SIZE)