<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, events, time_passed=None):
 """Update the menu and get input for the menu. @events: the pygame catched events @time_passed: delta time since the last call """

        for e in events:
            if e.type == pygame.QUIT:
                raise SystemExit

            if e.type == pygame.KEYDOWN:
                if e.key == pygame.K_ESCAPE:
                    raise SystemExit
                if e.key == pygame.K_DOWN:
                    self.option += 1
                if e.key == pygame.K_UP:
                    self.option -= 1
                if e.key == pygame.K_RETURN or e.key == pygame.K_SPACE:
                    self.options[self.option]['callable']()
            # Mouse controls
            elif e.type == pygame.MOUSEBUTTONDOWN:
                lb, cb, rb = pygame.mouse.get_pressed()
                if lb:
                    self.options[self.option]['callable']()
        # Menu limits
        if self.option > len(self.options) - 1:
            self.option = len(self.options) - 1
        elif self.option < 0:
            self.option = 0
        # Check for mouse position
        if self.mouse_enabled:
            self._checkMousePositionForFocus()
        if time_passed:
            self._updateEffects(time_passed)