As a part of a project I am working on, I had to cluster urls on a page. After some light googling I found, python-cluster. You can find below a simple python script to illustrate the usage of python-cluster library.
Code
import pprint
from difflib import SequenceMatcher
# http://python-cluster.sourceforge ...