def treated_routes(config, base_path='/'):
    """A dict containing each of the routes configured in this application.

    In your app configuration, ``config.make_wsgi_app()`` must be
    called *before* routes are extracted::

        app = config.make_wsgi_app()
        config.registry.app_routes = treated_routes(config)
        return app

    The return value is a dict like this::

         {'__static': '/static',  # static routes start with "__"
          'activate': '/activate/{user_id}/{code}'}
    """
    adict = {}
    for route in config.get_routes_mapper().routes.values():
        name = route.name.rstrip('/')
        pattern = route.pattern.strip('/')
        if pattern.endswith('/*subpath'):
            pattern = pattern[:-9]
        adict[name] = base_path + pattern
    return adict
