Idea taken from: https://community.openai.com/t/what-is-the-openai-algorithm-to-calculate-tokens/58237/4.