Equivalence of movvar matlab function using python