I know it works for controllers to keyboard, not sure about keyboard to keyboard, but you can try ControllerMate.
ControllerMate is a system that generates keyboard, mouse, and MIDI activity in response to triggers from gamepads, keypads, MIDI controllers, and other general-purpose input devices. It allows many types of devices to be used with software that would normally be compatible only with a keyboard, mouse, or MIDI source.
ControllerMate's internal devices generate activity based on a system of building blocks. Some building blocks respond to controls on input devices, other blocks trigger activity on ControllerMate's internal mouse and keyboard. Building blocks that implement timers, apply simple or complex logic, or perform basic math can also be created. Each individual building block performs a basic task, combinations of blocks can perform complex and creative functions.
A good thing about that app is you can choose to activate the remap for only the apps you want.