dbscan algorithm python from scratch