def delay(self, key):
last_action, target_delay = self.last[key], self.delays[key]<EOL>elapsed_time = time.time() - last_action<EOL>if elapsed_time < target_delay:<EOL><INDENT>t_remaining = target_delay - elapsed_time<EOL>time.sleep(t_remaining * random.uniform(<NUM_LIT>, <NUM_LIT>))<EOL><DEDENT>self.last[key] = time.time()<EOL>
Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`.