Sure, I'm able to write a function for this in Python or something like that...but how do i get it done in MYSQL?

WHERE title = "heart of darkness" more or less 3 characters...

An identical problem was talked about in this SO question, and here's a link in the recognized answer that presents a computation of Levenshtein distance in MYSQL.

Personally, however, I'd steer clear of the saved-procedure approach and merely implement it within the driving language (whether it is Python, PHP or anything you use to interface the DB).