This should do what the original commenter wanted:
(defun insert-keybinding (k) "Insert code for a keybinding." (interactive "kKey sequence: ") (insert (concat "(global-set-key (kbd \"" (key-description k) "\") 'function-name)")))
This should do what the original commenter wanted: