def register(self, entity, url_func):
        """Associate a `url_func` with entity's type.

        :param:entity: an :class:`abilian.core.extensions.db.Model` class or
        instance.

        :param:url_func: any callable that accepts an entity instance and
        return an url for it.
        """
        if not inspect.isclass(entity):
            entity = entity.__class__
        assert issubclass(entity, db.Model)
        self._map[entity.entity_type] = url_func