I am interested in implementing Q-learning (or some form of reinforcement learning) to find an optimal protocol. Currently, I have a function written in Python where I can take in the protocol or "action" and "state" and returns a new state and a "reward". However, I am having trouble finding a Python implementation of Q-learning that I can use in this situation (i.e. something that can learn the function as if it is a black box). I have looked at OpenAI gym but that would require writing a new environment. Would anyone know of a simpler package or script that I can adopt for this?

My code is of the form: 

```
def myModel (state, action, param1, param2):
    ...
    return (state, reward)

```

What I am looking for would be an algorithm of the form:

```
def QLearning (state, reward):
    ...
    return (action)

```

And some way to keeping the actions that transition between states. If anyone has any idea where to look for this, I would be very excited!