def METHOD_NAME(self, error: Exception, endpoint: str, values: Dict[str, Any]) -> str:
    """Looks up an external URL when `url_for` cannot build a URL."""
    url = self.lookup_external_url(endpoint, **values)
    if url is None:
        # External lookup did not have a URL.
        # Re-raise the BuildError, in context of original traceback.
        raise error
    # url_for will use this result, instead of raising BuildError.
    return url