Implementation of Euclid's algorithm in Python