Fixed #23627 -- Allowed register_lookup to work as a decorator.

Both patterns are now used in the test suite which should be enough to verify this works fine. The change was rather simple.
prefer if you add this bit below "Lookup registration can also be done..." and the code example with a note like "The ability to register lookups using a decorator was added." so instead of deintenting this block when we can just remove the note when the time comes (also code block inside versionchanged  seems to prevent syntax highlighting)