'Utility function to correct the values inside the components data
ndarray according to whether indices are covariant or contravariant.
It uses the metric matrix to lower values of covariant indices.'

@staticmethod
def _correct_signature_from_indices(data, indices, free, dum, inverse=False):

    for (i, indx) in enumerate(indices):
        if ((not indx.is_up) and (not inverse)):
            data = _TensorDataLazyEvaluator._flip_index_by_metric(data, indx.tensor_index_type.data, i)
        elif ((not indx.is_up) and inverse):
            data = _TensorDataLazyEvaluator._flip_index_by_metric(data, _TensorDataLazyEvaluator.inverse_matrix(indx.tensor_index_type.data), i)
    return data
