some algorithm implemented in python