Create and return a URL adapter.

        This will create the adapter based on the request if present
        otherwise the app configuration.

def create_url_adapter(self, request: Optional[BaseRequestWebsocket]) -> Optional[MapAdapter]:
        """Create and return a URL adapter.

        This will create the adapter based on the request if present
        otherwise the app configuration.
        """
        if request is not None:
            host = request.host
            return self.url_map.bind_to_request(
                request.scheme, host, request.method, request.path, request.query_string,
            )

        if self.config['SERVER_NAME'] is not None:
            return self.url_map.bind(
                self.config['PREFERRED_URL_SCHEME'], self.config['SERVER_NAME'],
            )
        return None