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.