code: def key_binding(self, keydef, mode='force'):
          
          def register(fun):
              fun.mpv_key_bindings = getattr(fun, 'mpv_key_bindings', []) + [keydef]
              def unregister_all():
                  for keydef in fun.mpv_key_bindings:
                      self.unregister_key_binding(keydef)
              fun.unregister_mpv_key_bindings = unregister_all
  
              self.register_key_binding(keydef, fun, mode)
              return fun
          return register
docs: Function decorator to register a low-level key binding.
  
          The callback function signature is ``fun(key_state, key_name)`` where ``key_state`` is either ``'U'`` for "key
          up" or ``'D'`` for "key down".
  
          The keydef format is: ``[Shift+][Ctrl+][Alt+][Meta+]<key>`` where ``<key>`` is either the literal character the
          key produces (ASCII or Unicode character), or a symbolic name (as printed by ``mpv --input-keylist``).
  
          To unregister the callback function, you can call its ``unregister_mpv_key_bindings`` attribute::
  
              player = mpv.MPV()
              @player.key_binding('Q')
              def binding(state, name):
                  print('blep')
  
              binding.unregister_mpv_key_bindings()
  
          WARNING: For a single keydef only a single callback/command can be registered at the same time. If you register
          a binding multiple times older bindings will be overwritten and there is a possibility of references leaking. So
          don't do that.
  
          BIG FAT WARNING: mpv's key binding mechanism is pretty powerful.  This means, you essentially get arbitrary code
          exectution through key bindings. This interface makes some limited effort to sanitize the keydef given in the
          first parameter, but YOU SHOULD NOT RELY ON THIS IN FOR SECURITY. If your input comes from config files, this is
          completely fine--but, if you are about to pass untrusted input into this parameter, better double-check whether
          this is secure in your case.