add python equivalent for julia code