RSA algorithm implemented in Python