Python version of isawake