Source: https://github.com/mwidjaja/cpython/blob/ad7a395f39e35afcd62552471e0de5e01cfe72d5/Lib/pstats.py