(expr, independent=False, recursive_limit=10,
                               _recursive_depth=0)
return Add(*new_terms)
Helper function for normal_ordered_form: loop through each term in an
    addition expression and call _normal_ordered_form_factor to perform the
    factor to an normally ordered expression.
Helper function for normal_ordered_form: loop through each term in an
    addition expression and call _normal_ordered_form_factor to perform the
    factor to an normally ordered expression.
Helper function for normal_ordered_form : loop through each term in an addition expression and call _normal_ordered_form_factor to perform the factor to an normally ordered expression .
def _normal_ordered_form_terms(expr, independent=False, recursive_limit=10,
                               _recursive_depth=0):
    """
    Helper function for normal_ordered_form: loop through each term in an
    addition expression and call _normal_ordered_form_factor to perform the
    factor to an normally ordered expression.
    """

    new_terms = []
    for term in expr.args:
        if isinstance(term, Mul):
            new_term = _normal_ordered_form_factor(
                term, recursive_limit=recursive_limit,
                _recursive_depth=_recursive_depth, independent=independent)
            new_terms.append(new_term)
        else:
            new_terms.append(term)

    return Add(*new_terms)
def _normal_ordered_form_terms ( expr , independent = False , recursive_limit = 10 , _recursive_depth = 0 ) : new_terms = [ ] for term in expr . args : if isinstance ( term , Mul ) : new_term = _normal_ordered_form_factor ( term , recursive_limit = recursive_limit , _recursive_depth = _recursive_depth , independent = independent ) new_terms . append ( new_term ) else : new_terms . append ( term ) return Add ( * new_terms )