Can I use python libraries to write faster code

Is it ok to use python math library for calculations, I am just a begginer so I am using euclidian algorithm to calculate gcd to solve a problem which is slow and time limit exceeds, so is using a library a bad idea and I should learn faster algorithms or it is ok to do.