pybktree is a generic, pure Python implementation of a BK-tree data structure, which allows fast querying of "close" matches (for example, matches with small hamming distance or Levenshtein distance). This module is based on the algorithm by Nick Johnson in his blog article on BK-trees. For large trees and fairly small N when calling find(), using a BKTree is much faster than doing a linear search. This is especially good when you're de-duping a few hundred thousand photos -- with a linear search that would become a very slow, O(N²) operation. With a BKTree, it's more like O(N log N).