Populate GSSHAPY MTValue and MTIndex Objects Method

def _createValueObjects(self, valueList, varList, mapTable, indexMap, contaminant, replaceParamFile):
        """
        Populate GSSHAPY MTValue and MTIndex Objects Method
        """
        def assign_values_to_table(value_list, layer_id):
            for i, value in enumerate(value_list):
                value = vrp(value, replaceParamFile)
                # Create MTValue object and associate with MTIndex and MapTable
                mtValue = MTValue(variable=varList[i], value=float(value))
                mtValue.index = mtIndex
                mtValue.mapTable = mapTable
                mtValue.layer_id = layer_id

                # MTContaminant handler (associate MTValue with MTContaminant)
                if contaminant:
                    mtValue.contaminant = contaminant

        for row in valueList:
            # Create GSSHAPY MTIndex object and associate with IndexMap
            mtIndex = MTIndex(index=row['index'], description1=row['description1'], description2=row['description2'])
            mtIndex.indexMap = indexMap
            if len(np.shape(row['values'])) == 2:
                # this is for ids with multiple layers
                for layer_id, values in enumerate(row['values']):
                    assign_values_to_table(values, layer_id)
            else:
                assign_values_to_table(row['values'], 0)