Python relay control