如何仅用两个键即左和右控制蛇

目前,我正在使用所有四个键来左右操纵蛇。我想知道如何只用左右键移动蛇。

                    if event.key == pygame.K_LEFT:
                        snake.direction = 2
                    elif event.key == pygame.K_RIGHT:
                        snake.direction = 3
                    elif event.key == pygame.K_UP:
                        snake.direction = 0
                    elif event.key == pygame.K_DOWN:
                        snake.direction = 1
    def move(self):
        if self.direction is 0:
            self.dy = -self.block
            self.dx = 0
        if self.direction is 1:
            self.dy = self.block
            self.dx = 0
        if self.direction is 2:
            self.dy = 0
            self.dx = -self.block
        if self.direction is 3:
            self.dy = 0
            self.dx = self.block
        self.x += self.dx
        self.y += self.dy

谁能指导我该怎么做?