accessible-keymaps

accessible-keymaps is a built-in function in `C source code'.

(accessible-keymaps KEYMAP &optional PREFIX)

Find all keymaps accessible via prefix characters from KEYMAP.
Returns a list of elements of the form (KEYS . MAP), where the sequence
KEYS starting from KEYMAP gets you to MAP. These elements are ordered
so that the KEYS increase in length. The first element is ([] . KEYMAP).
An optional argument PREFIX, if non-nil, should be a key sequence;
then the value includes only maps for prefixes that start with PREFIX.