Implementing your own k-nearest neighbour algorithm using Python