How can I simulate keystrokes/ keyboard input in Python?

Over the course of a few weeks, I have been programming a robot (called a Finch), to respond to commands from a Wii remote. I planned to use a raspberry pi to run the code so i could make it more mobile. I wrote a program in Java that lets me control movement with the arrow keys, and other keys like A, S, D, Q, W, R, F, J, K, L, M, do other things like change the LED color or make it say something. After I finished that, I wrote some python code that uses the CWiid library. I tested the code on the pi, and it works, its just that I don't know how to use it to send input that my Java program can use.