Made to_python use yaml.safe_load()