Implementing the Bailie-PSW test for primality in Python 3