'Translate from keycap symbol to the Tkinter keysym'

def TranslateKey(self, key, modifiers):

    translateDict = {'Space': 'space', '~': 'asciitilde', '!': 'exclam', '@': 'at', '#': 'numbersign', '%': 'percent', '^': 'asciicircum', '&': 'ampersand', '*': 'asterisk', '(': 'parenleft', ')': 'parenright', '_': 'underscore', '-': 'minus', '+': 'plus', '=': 'equal', '{': 'braceleft', '}': 'braceright', '[': 'bracketleft', ']': 'bracketright', '|': 'bar', ';': 'semicolon', ':': 'colon', ',': 'comma', '.': 'period', '<': 'less', '>': 'greater', '/': 'slash', '?': 'question', 'Page    Up': 'Prior', 'Page    Down': 'Next', 'Left    Arrow': 'Left', 'Right    Arrow': 'Right', 'Up    Arrow': 'Up', 'Down    Arrow': 'Down', 'Tab': 'Tab'}
    if (key in translateDict):
        key = translateDict[key]
    if (('Shift' in modifiers) and (key in string.ascii_lowercase)):
        key = key.upper()
    key = ('Key-' + key)
    return key
