updated py snippet