code: def dumpkey(key):
      
      def hex3fy(key):
          """Helper to convert string into hex string (Python 3 compatible)"""
          from binascii import hexlify
          # Python 3 strings are no longer binary, encode them for hexlify()
          if PY3K:
             key = key.encode('utf-8')
          keyhex = hexlify(key).upper()
          if PY3K:
             keyhex = keyhex.decode('utf-8')
          return keyhex
      if type(key) == str:
          return hex3fy(key)
      else:
          return ' '.join( [hex3fy(s) for s in key] )
docs: Helper to convert result of `getch` (string) or `getchars` (list)
      to hex string.