code: def _on_input_event(self, event):
      if redis_client.get(self.redis_key_pause) == b"1":
          return None
  
      if redis_client.get(self.redis_key_stop) == b"1":
          self.stop()
          return None
  
      if isinstance(event, KeyboardEvent):
          if event.event == KeyboardEvents.DOWN:
              if event.keyboard_key.name in self.active_keys:
                  return None
  
              self.active_keys.add(event.keyboard_key.name)
          elif event.event == KeyboardEvents.UP:
              if event.keyboard_key.name in self.active_keys:
                  self.active_keys.remove(event.keyboard_key.name)
  
          event = {
              "type": "keyboard",
              "name": f"{event.keyboard_key.name}-{event.event.value.upper()}",
              "timestamp": event.timestamp,
          }
  
          event = pickle.dumps(event)
          redis_client.rpush(
              config["input_recorder"]["redis_key"], event
          )
      elif isinstance(event, MouseEvent):
          event = {
              "type": "mouse",
              "name": event.event.name,
              "button": event.button.name if event.button else None,
              "direction": event.direction if event.direction else None,
              "velocity": event.velocity if event.velocity else None,
              "x": event.x,
              "y": event.y,
              "timestamp": event.timestamp,
          }
  
          event = pickle.dumps(event)
          redis_client.rpush(
              config["input_recorder"]["redis_key"], event
          )
  
file_path: SerpentAI/serpent/input_recorder.py
imports: import pickle
  import time
  from redis import StrictRedis
  from serpent.config import config
  from sneakysnek.recorder import Recorder
  from sneakysnek.keyboard_event import KeyboardEvent, KeyboardEvents
  from sneakysnek.mouse_event import MouseEvent
label_desc: Use image node_id 4 for calling the InputRecorder obj's underlying member method code with example usage: obj._on_input_event(event) and returns: None, None, None