I don't know in what sort of context you will want to run such a macro, but I will assume it is for when typing into a document.
The macro subspace is called by space but, despite its hastily chosen name, it isn't a subroutine. The global variable next_key is used.
For test purposes, the wait for the second key is set to 2 seconds – which of course you can change... and see what happens.
The subspace macro must be initially disabled.
One of the inspirations for this attempt was this post by Peter Lewis.

