Python code for Babai's algorithm
compiled using $sage -python <filename>