Update rpc.py to use struct library for compatibility