It is possible to use the onkeypress() function, however, the name of the shift key is "Shift_L", which is the shift key on the left, and "Shift_R", which is the shift key on the right. This is what the code should look like:
import turtle
walk_speed=10
def sprint():
global walk_speed
walk_speed+=8
def slow():
global walk_speed
walk_speed-=8
screen.onkeypress(sprint, "Shift_L")
screen.onkeyrelease(slow, "Shift_L")
screen.onkeypress(sprint, "Shift_R")
screen.onkeyrelease(slow, "Shift_R")