code: def keysym_to_string(keysym):
      '''Translate a keysym (16 bit number) into a python string.
  
      This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
      XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other
      values it returns None.'''
  
      # ISO latin 1, LSB is the code
      if keysym & 0xff00 == 0:
          return chr(keysym & 0xff)
  
      if keysym in [XK_BackSpace, XK_Tab, XK_Clear, XK_Return,
                    XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete]:
          return chr(keysym & 0xff)
  
      # We should be able to do these things quite automatically
      # for latin2, latin3, etc, in Python 2.0 using the Unicode,
      # but that will have to wait.
  
      return Nonf keysym_to_string(keysym):
      '''Translate a keysym (16 bit number) into a python string.
  
      This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
      XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other
      values it returns None.'''
  
      # ISO latin 1, LSB is the code
      if keysym & 0xff00 == 0:
          return chr(keysym & 0xff)
  
      if keysym in [XK_BackSpace, XK_Tab, XK_Clear, XK_Return,
                    XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete]:
          return chr(keysym & 0xff)
  
      # We should be able to do these things quite automatically
      # for latin2, latin3, etc, in Python 2.0 using the Unicode,
      # but that will have to wait.
  
      return None
docs: Translate a keysym (16 bit number) into a python string.
  
      This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
      XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other
      values it returns None.