This looks a lot like the `handler_prefix` function at the top of the file.