code: def _get_keycodes():
      
      try:
          return _key_cache.pop()
      except IndexError:
          pass
      result = []
      terminators = 'ABCDFHPQRS~'
      with TerminalContext():
          code = get_ord()
          result.append(code)
          if code == 27:
              with TimerContext(0.1) as timer:
                  code = get_ord()
              if not timer.timed_out:
                  result.append(code)
                  result.append(get_ord())
                  if 64 < result[-1] < 69:
                      pass
                  elif result[1] == 91:
                      while True:
                          code = get_ord()
                          result.append(code)
                          if chr(code) in terminators:
                              break
      return tuple(result)
docs: Read keypress giving a tuple of key codes
  
      A 'key code' is the ordinal value of characters read
  
      For example, pressing 'A' will give (65,)