<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def route_to_alt_domain(request, url):
 """Route URL to a different subdomain. Used to rewrite URLs to point to websocket serving domain. """


    # Do we need to route IPython Notebook request from a different location
    alternative_domain = request.registry.settings.get("pyramid_notebook.alternative_domain", "").strip()
    if alternative_domain:
        url = url.replace(request.host_url, alternative_domain)

    return url