how about `for key in [k for k in keys if k not in known_keys]:` to avoid the double indentation.