'Returns the ``args`` sorted according to the components commutation
properties.
The sorting is done taking into account the commutation group
of the component tensors.'

def _sort_args_for_sorted_components(self):

    cv = [arg for arg in self.args if isinstance(arg, TensExpr)]
    sign = 1
    n = (len(cv) - 1)
    for i in range(n):
        for j in range(n, i, (-1)):
            c = cv[(j - 1)].commutes_with(cv[j])
            if (c not in [0, 1]):
                continue
            if ((cv[(j - 1)].component.types, cv[(j - 1)].component.name) > (cv[j].component.types, cv[j].component.name)):
                (cv[(j - 1)], cv[j]) = (cv[j], cv[(j - 1)])
                if c:
                    sign = (- sign)
    coeff = (sign * self.coeff)
    if (coeff != 1):
        return ([coeff] + cv)
    return cv
