'Wait observer is running and returns if observer idle (observer sleeps)'

def wait_idle(self, sleeptime=None):

    time.sleep(ObserverThread.DEFAULT_SLEEP_INTERVAL)
    if self.idle:
        return True
    if (sleeptime is not None):
        e = (MyTime.time() + sleeptime)
    while (not self.idle):
        if ((sleeptime is not None) and (MyTime.time() > e)):
            break
        time.sleep(ObserverThread.DEFAULT_SLEEP_INTERVAL)
    return self.idle
