DSR template in python