You probably won't be able to make a single function out of every outcome of a key press which is why I wouldn't use functions to begin with because what you're describing is not repeatable bits of code. I use events based on the key pressed, not detect any key pressed then pass the key pressed through a function and determine it's outcome all inside one function, seems unnecessary.
If I press 'down' then the player falls through a platform, that's one event. In a separate event if I press down and I am in the menu then other things may happen based off menu=1, I don't need functions.
You can also make use of groups. If you are in the menu then you can disable the player controls group for example.
Maybe some hardcore developer has got an idea about these 'callbacks' and will respond with their input but I wouldn't use them myself.