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.

@asmit28 yeah its easy to use python libraries, but its not a good practice to solve contest question with python as it is slow and will give you time limit. I suggest to use c++ or java.