implementations of k nearest neighbor algorithm in python