python-cluster is a package that allows grouping a list of arbitrary objects into related groups (clusters). Simply give it a list of data and a function to determine the similarity between two items and you're done.