Writing An Emulator In Python