code: def parse_uinput_mapping(name, mapping):
      
      axes, buttons, mouse, mouse_options = {}, {}, {}, {}
      description = "ds4drv custom mapping ({0})".format(name)
  
      for key, attr in mapping.items():
          key = key.upper()
          if key.startswith("BTN_") or key.startswith("KEY_"):
              buttons[key] = attr
          elif key.startswith("ABS_"):
              axes[key] = attr
          elif key.startswith("REL_"):
              mouse[key] = attr
          elif key.startswith("MOUSE_"):
              mouse_options[key] = attr
  
      create_mapping(name, description, axes=axes, buttons=buttons,
                     mouse=mouse, mouse_options=mouse_options)
docs: Parses a dict of mapping options.