How to determine CPU and memory cost of a function in Python?
stackoverflow.com