def extract_type_tens(expression, component):
    '\n    Extract from a ``TensExpr`` all tensors with `component`.\n\n    Returns two tensor expressions:\n\n    * the first contains all ``Tensor`` of having `component`.\n    * the second contains all remaining.\n\n\n    '
    if isinstance(expression, Tensor):
        sp = [expression]
    elif isinstance(expression, TensMul):
        sp = expression.args
    else:
        raise ValueError('wrong type')
    new_expr = S.One
    residual_expr = S.One
    for i in sp:
        if (isinstance(i, Tensor) and (i.component == component)):
            new_expr *= i
        else:
            residual_expr *= i
    return (new_expr, residual_expr)
Extract from a ``TensExpr`` all tensors with `component`.

Returns two tensor expressions:

* the first contains all ``Tensor`` of having `component`.
* the second contains all remaining.
def extract_type_tens(expression, component):
    '\n    Extract from a ``TensExpr`` all tensors with `component`.\n\n    Returns two tensor expressions:\n\n    * the first contains all ``Tensor`` of having `component`.\n    * the second contains all remaining.\n\n\n    '
    if isinstance(expression, Tensor):
        sp = [expression]
    elif isinstance(expression, TensMul):
        sp = expression.args
    else:
        raise ValueError('wrong type')
    new_expr = S.One
    residual_expr = S.One
    for i in sp:
        if (isinstance(i, Tensor) and (i.component == component)):
            new_expr *= i
        else:
            residual_expr *= i
    return (new_expr, residual_expr)