def get_example_runner(document):
    """Get or create the :class:`ExampleRunner` instance associated with
    a document.
    """
    runner = getattr(document, "click_example_runner", None)
    if runner is None:
        runner = document.click_example_runner = ExampleRunner()
    return runner