python data set build function