Rather than re-implement this it might be better to use an existing library. In Python, I've used pylevenshtein:
http://code.google.com/p/pylevenshtein/
However, I've found the Jaro-Winkler distance to be more useful than the Levenshtein. You can find good implementations for Jaro out there as well.