Python Unsupervised Pattern Recognition