<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_events(self):

 """
 Loop through and handle all the queued events.
 """

        for event in sdl2.ext.get_events():
            if event.type == sdl2.SDL_MOUSEMOTION:
                self.example.mouse_position_event(event.motion.x, event.motion.y)

            elif event.type == sdl2.SDL_MOUSEBUTTONUP:
                # Support left and right mouse button for now
                if  event.button.button in [1, 3]:
                    self.example.mouse_press_event(
                        event.motion.x, event.motion.y,
                        1 if event.button.button == 1 else 2,
                    )

            elif event.type == sdl2.SDL_MOUSEBUTTONDOWN:
                # Support left and right mouse button for now
                if  event.button.button in [1, 3]:
                    self.example.mouse_release_event(
                        event.motion.x, event.motion.y,
                        1 if event.button.button == 1 else 2,
                    )

            elif event.type in [sdl2.SDL_KEYDOWN, sdl2.SDL_KEYUP]:
                if event.key.keysym.sym == sdl2.SDLK_ESCAPE:
                    self.close()

                self.example.key_event(event.key.keysym.sym, event.type)

            elif event.type == sdl2.SDL_QUIT:
                self.close()

            elif event.type == sdl2.SDL_WINDOWEVENT:
                if event.window.event == sdl2.SDL_WINDOWEVENT_RESIZED:
                    self.resize(event.window.data1, event.window.data2)