You just move the sprite to self.x+value and back, repeat a few times.
You can make a basic attempt by doing something like this
set to self.x+10
wait 0.1 seconds
set to self.x-10
wait 0.1 seconds
set to self.x+10
wait 0.1 seconds
set to self.x-10
Or you can put it in a function, replace the 10 and 0.1 with parameters to define the distance and how quickly it shakes.