How one might correct typos (in URLs or words) by looking for closest distance matches. And a Python module called Levenshtein to solve this. This recipe contains bktree.py which implements Fast Levenshtein distance (Wagner-Fischer algorithm) and the BK-tree. A recipe for calculating the Levenshtein distance between two strings. [1] [2]