human
Complete the below
@nottest
def TestingCanvas(bgcolor='black', size=(100, 100), dpi=None, decorate=False, **kwargs):

    ''''Class wrapper to avoid importing scene until necessary'
    '''
 ... Give me a the Python code you requested?
assistant
#Here is the Python code you requested.
    from ..scene import SceneCanvas
    class TestingCanvas(SceneCanvas, ):
        def __init__(self, bgcolor, size, dpi, decorate, **kwargs):
            self._entered = False
            self._wanted_vp = None
            SceneCanvas.__init__(self, bgcolor=bgcolor, size=size, dpi=dpi, decorate=decorate, **kwargs)
        def __enter__(self):
            SceneCanvas.__enter__(self)
            scale = (np.array(self.physical_size) / np.array(self.size, float))
            scale = int(np.round(np.mean(scale)))
            self._wanted_vp = (0, 0, (size[0] * scale), (size[1] * scale))
            self.context.set_state(clear_color=self._bgcolor)
            self.context.set_viewport(*self._wanted_vp)
            self._entered = True
            return self
        def draw_visual(self, visual, event=None):
            if (not self._entered):
                return
            SceneCanvas.draw_visual(self, visual, event)
            self.context.finish()
    return TestingCanvas(bgcolor, size, dpi, decorate, **kwargs)