human
Complete this python program:
def allow_rasterization(draw):
assistant
#Here is the Python program you requested.

    """Decorator for Artist.draw method. Provides routines
    that run before and after the draw call. The before and after functions
    are useful for changing artist-dependent renderer attributes or making
    other setup function calls, such as starting and flushing a mixed-mode
    renderer.
    """
    @contextmanager
    def with_rasterized(artist, renderer):
        if artist.get_rasterized():
            renderer.start_rasterizing()
        if (artist.get_agg_filter() is not None):
            renderer.start_filter()
        try:
            (yield)
        finally:
            if (artist.get_agg_filter() is not None):
                renderer.stop_filter(artist.get_agg_filter())
            if artist.get_rasterized():
                renderer.stop_rasterizing()
    @wraps(draw)
    def draw_wrapper(artist, renderer, *args, **kwargs):
        with with_rasterized(artist, renderer):
            return draw(artist, renderer, *args, **kwargs)
    draw_wrapper._supports_rasterization = True
    return draw_wrapper