Replace references to deleted variable 'sleep'

This fixes the error

NameError: global name 'sleep' is not defined