Python motor code for pi