Improve {% url %} tag performance

1. Replace a table scan of the routes with a dictionary lookup (i.e.
create a new table for reverse routing)

2. Move the fancy token-matching logic out of the router into the
calling process.