Look up the key sequence in key map.

        If ``keysequence`` leads to a macro in the key map represented
        by this object then the method returns ``(macroName,
        True)``. If it does not lead to a macro but is nonetheless
        valid (ie. the sequence is still incomplete), then it returns
        ``(None, True)``. Finally, if the sequence cannot lead to a
        macro because it is invalid then the return value is ``(None,
        False)``.

        |Args|

        * ``keysequence`` (**QtmacsKeysequence**): associate a macro
          with a key sequence in this key map.
        * ``macroName`` (**str**): macro name.

        |Returns|

        (**str**: macro name, **bool**: partial match)

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.

def match(self, keysequence: QtmacsKeysequence):
        """
        Look up the key sequence in key map.

        If ``keysequence`` leads to a macro in the key map represented
        by this object then the method returns ``(macroName,
        True)``. If it does not lead to a macro but is nonetheless
        valid (ie. the sequence is still incomplete), then it returns
        ``(None, True)``. Finally, if the sequence cannot lead to a
        macro because it is invalid then the return value is ``(None,
        False)``.

        |Args|

        * ``keysequence`` (**QtmacsKeysequence**): associate a macro
          with a key sequence in this key map.
        * ``macroName`` (**str**): macro name.

        |Returns|

        (**str**: macro name, **bool**: partial match)

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.
        """
        try:
            # Look up the ``keysequence`` in the current key map (ie.
            # this very object which inherits from ``dict``). If
            # ``keysequence`` does not lead to a valid macro then
            # return **None**.
            macroName = self
            for _ in keysequence.toQtKeylist():
                macroName = macroName[_]
        except KeyError:
            # This error occurs if the keyboard sequence does not lead
            # to any macro and is therefore invalid.
            return (None, False)

        # At this point we know that the key sequence entered so far
        # exists. Two possibilities from here on forward: 1) the key
        # sequence now points to a macro or 2) the key sequence is
        # still incomplete.
        if isinstance(macroName, dict):
            # Another dictionary --> key sequence is still incomplete.
            return (None, True)
        else:
            # Macro object --> return it.
            return (macroName, True)