Kd-tree code from Astrometry.net, with python bindings and i/o to FITS format