python based code for integer partitioning