Add python implementation