>90% of the time is spent on method 'acquire' of 'thread.lock' objects

To identify the step that is using most of the computation time, I ran cProfile and got the following result: ncalls tottime percall cumtime percall filename:lineno(function) 1 0...