<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _factors_for_expand_delta(expr):
 """Yield factors from expr, mixing sympy and QNET Auxiliary routine for :func:`_expand_delta`. """

    from qnet.algebra.core.scalar_algebra import ScalarValue
    from qnet.algebra.core.abstract_quantum_algebra import (
        ScalarTimesQuantumExpression)
    if isinstance(expr, ScalarTimesQuantumExpression):
        yield from _factors_for_expand_delta(expr.coeff)
        yield expr.term
    elif isinstance(expr, ScalarValue):
        yield from _factors_for_expand_delta(expr.val)
    elif isinstance(expr, sympy.Basic) and expr.is_Mul:
        yield from expr.args
    else:
        yield expr