I’ve had my Razer Black Widow Ultimate for a long time now. It’s absolutely my favorite keyboard. Here is how I easily mapped the M keys in Ubuntu Linux. Info taken from here and here.

Step 1: install the python-usb package:

sudo apt-get install python-usb

Step 2: Grab blackwidow_enable.py from the link above

wget http://finch.am/projects/blackwidow/blackwidow_enable.py

Step 3: Change permissions on blackwidow_enable.py

chmod +x blackwidow_enable.py

Step 4: Add it to startup

sudo vi /etc/rc.local

Add this line:

python /home/halo/Downloads/blackwidow_enable.py

/etc/rc.local should look like this (Obviously your path will be different):
BlackWidowStartup

Save, Bind your keys, and reboot to test!