def display_colab(
    client: Client,
    cell: NotebookCell,
    proxy_url: str = None,
    reactivate: bool = False,
) -> None:
    """Display a FiftyOne instance in a Colab output frame.

    The Colab VM is not directly exposed to the network, so the Colab runtime
    provides a service worker tunnel to proxy requests from the end user's
    browser through to servers running on the Colab VM: the output frame may
    issue requests to https://localhost:<port> (HTTPS only), which will be
    forwarded to the specified port on the VM.

    It does not suffice to create an `iframe` and let the service worker
    redirect its traffic (`<iframe src="https://localhost:6006">`), because for
    security reasons service workers cannot intercept iframe traffic. Instead,
    we manually fetch the FiftyOne index page with an XHR in the output frame,
    and inject the raw HTML into `document.body`.
    """
    # pylint: disable=no-name-in-module,import-error
    from google.colab import output

    style_text = Template(fost.SCREENSHOT_STYLE).render(
        subscription=cell.subscription
    )
    html = Template(fost.SCREENSHOT_COLAB).render(
        style=style_text, subscription=cell.subscription
    )
    script = Template(fost.SCREENSHOT_COLAB_SCRIPT).render(
        height=cell.height, port=cell.port, subscription=cell.subscription
    )

    cell.handle.display(IPython.display.HTML(html))
    output.eval_js(script)

    def capture(img: str, width: int) -> None:
        with output.redirect_to_element(f"#focontainer-{cell.subscription}"):
            IPython.display.display(
                IPython.display.HTML(
                    f"<img src='{img}' style='width: 100%%; max-width: {width}px;'/>"
                )
            )

    output.register_callback(
        f"fiftyone.{cell.subscription.replace('-', '_')}", capture
    )

    output.register_callback(
        f"fiftyone.deactivate.{cell.subscription.replace('-', '_')}",
        lambda: client.send_event(fose.DeactivateNotebookCell()),
    )
Display a FiftyOne instance in a Colab output frame.

    The Colab VM is not directly exposed to the network, so the Colab runtime
    provides a service worker tunnel to proxy requests from the end user's
    browser through to servers running on the Colab VM: the output frame may
    issue requests to https://localhost:<port> (HTTPS only), which will be
    forwarded to the specified port on the VM.

    It does not suffice to create an `iframe` and let the service worker
    redirect its traffic (`<iframe src="https://localhost:6006">`), because for
    security reasons service workers cannot intercept iframe traffic. Instead,
    we manually fetch the FiftyOne index page with an XHR in the output frame,
    and inject the raw HTML into `document.body`.
    
fiftyone/core/session/notebooks.py