Function keys function toggle
This works for me using the latest version of Sierra and 15 inch MBP (non-touch bar)

Using Automator, create a new file and choose “New Service” as your option

Add A “Run AppleScript command” to your workflow, and insert the following AppleScript code

tell application "System Preferences"
    reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences" to tell window 1
    click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1
end tell
quit application "System Preferences"




Save your new Automator service, naming it something like... "Toggle Function Keys"

Next, just open System Preferences/Keyboard/Shortcuts/Services And you should see your new "Toggle Function Keys" service Located in the "General" sub-menu And assign it a Keyboard shortcut.



Your new service can now be activated using the keyboard shortcut you created and in the "Services" menu while using any application.





You also have another option.  

You own a Mac! It's a very powerful tool which is supposed to make your life easier.  So make your life easier and let your Mac do your work for you. 

If you are crazy lazy like I am, you can save that AppleScript code in my answer, in the script editor app as a script and name it something like “Toggle Function Keys.scpt”.  You can make the action of toggling your function keys on and off “speakable”.  Meaning you can run the script with a dictation command.

Here’s the process...

Enable enhanced dictation and dictation commands in your system preferences.



As you can see in my next image, I set “computer” as my keyword phrase...



Now with enhanced dictation ready to rock'n roll, I selected the “Toggle Function Keys.scpt” file in Finder and spoke the phrase “computer make this speakable”

Speaking that command opened up this dialog box



Now any time I want to toggle my function keys, I simply say the command “Computer Toggle Function Keys” and it runs  “Toggle Function Keys.scpt” and performs all the actions in that script file