Mapping buttons for Python Scripts

Is there any information for mapping GameShell buttons to use in Python scripts/console applications or any GameShell Python libraries that can facilitate this?

Potential use case examples:

  1. Make selections by pressing a button in a console application
  2. Being able to cycle through selections in a console application using the d-pad.

My apologies if something like this has already been covered.