Updated python snippet