K means implementation in python