The “HTML: Encode Special Characters” entry in the Command Palette corresponds to the “encode_html_entities” command. If you put the following in your “Default (OSX). sublime-keymap” file (or other OS-appropriate keymap file), it will bind the command to the super+shift+7 keystroke:
{ "keys": "super+shift+7"], "command": "encode_html_entities" }
Edited to add: The Python script you mentioned defined the encode_html_entities command. The command is loaded by Sublime, so you don’t have to figure out how to run the script. Sublime takes care of calling the script, whether you execute it via the Command Palette, a keystroke in a keymap, etc. Magic!
h.b.