Reterminal keys in Python

Is there a simple Python sample that shows how to use the reTerminal buttons? I am a bit of a Python noob, and the sample project is too involved for me to comprehend. Just looking for the most basic example of how to use them.

I think I figured it out. Posting this sample code here for the next person who needs a hand.

import sys
import os
from evdev import *

while True:
    key = InputDevice("/dev/input/event0")
    for event in key.read_loop():
        if event.type == ecodes.EV_KEY:
            keyevents = repr(event)
            val_list = keyevents.replace('(','').replace(')','').replace(' ','').split(',')
            if val_list[3] == '33':
                key_4 = int(val_list[4])
                print("key 4 was pressed")
            if val_list[3] == '32':
                key_3 = int(val_list[4])
                print("key 3 was pressed")
            if val_list[3] == '31':
                key_2 = int(val_list[4])
                print("key 2 was pressed")
            if val_list[3] == '30':
                key_1 = int(val_list[4])
                print("key 1 was pressed")