'Returns True if the given stack-frame represents a known
sleeper function (at least in python 2.5)'

def thread_is_sleeping(self, last_stack_frame):

    _filename = last_stack_frame[0]
    _funcname = last_stack_frame[2]
    _text = last_stack_frame[3]
    if ((_funcname == 'wait') and (_text == 'waiter.acquire()')):
        return True
    if ((_funcname == 'wait') and (_text == '_sleep(delay)')):
        return True
    if ((_funcname == 'accept') and (_text[(-14):] == '_sock.accept()')):
        return True
    if ((_funcname in ('monitor', '__monitor', 'app_loop', 'check')) and _text.startswith('time.sleep(') and _text.endswith(')')):
        return True
    if ((_funcname == 'drain_events') and (_text == 'sleep(polling_interval)')):
        return True
    if (_filename.find('/lib/galaxy/util/heartbeat.py') != (-1)):
        return True
    return False
