code: def test_eval_trace():
      # This test includes tests with dependencies between TensorProducts
      # and density operators. Since, the test is more to test the behavior of
      # TensorProducts it remains here
  
      A, B, C, D, E, F = symbols("A B C D E F", commutative=False)
  
      # Density with simple tensor products as args
      t = TensorProduct(A, B)
      d = Density([t, 1.0])
      tr = Tr(d)
      assert tr.doit() == 1.0 * Tr(A * Dagger(A)) * Tr(B * Dagger(B))
  
      ## partial trace with simple tensor products as args
      t = TensorProduct(A, B, C)
      d = Density([t, 1.0])
      tr = Tr(d, [1])
      assert tr.doit() == 1.0 * A * Dagger(A) * Tr(
          B * Dagger(B)
      ) * C * Dagger(C)
  
      tr = Tr(d, [0, 2])
      assert tr.doit() == 1.0 * Tr(A * Dagger(A)) * B * Dagger(B) * Tr(
          C * Dagger(C)
      )
  
      # Density with multiple Tensorproducts as states
      t2 = TensorProduct(A, B)
      t3 = TensorProduct(C, D)
  
      d = Density([t2, 0.5], [t3, 0.5])
      t = Tr(d)
      assert t.doit() == (
          0.5 * Tr(A * Dagger(A)) * Tr(B * Dagger(B))
          + 0.5 * Tr(C * Dagger(C)) * Tr(D * Dagger(D))
      )
  
      t = Tr(d, [0])
      assert t.doit() == (
          0.5 * Tr(A * Dagger(A)) * B * Dagger(B)
          + 0.5 * Tr(C * Dagger(C)) * D * Dagger(D)
      )
  
      # Density with mixed states
      d = Density([t2 + t3, 1.0])
      t = Tr(d)
      assert t.doit() == (
          1.0 * Tr(A * Dagger(A)) * Tr(B * Dagger(B))
          + 1.0 * Tr(A * Dagger(C)) * Tr(B * Dagger(D))
          + 1.0 * Tr(C * Dagger(A)) * Tr(D * Dagger(B))
          + 1.0 * Tr(C * Dagger(C)) * Tr(D * Dagger(D))
      )
  
      t = Tr(d, [1])
      assert t.doit() == (
          1.0 * A * Dagger(A) * Tr(B * Dagger(B))
          + 1.0 * A * Dagger(C) * Tr(B * Dagger(D))
          + 1.0 * C * Dagger(A) * Tr(D * Dagger(B))
          + 1.0 * C * Dagger(C) * Tr(D * Dagger(D))
      )
  
imports: from sympy.core.numbers import I
  from sympy.core.symbol import symbols
  from sympy.core.expr import unchanged
  from sympy.matrices import Matrix, SparseMatrix, ImmutableMatrix
  from sympy.physics.quantum.commutator import Commutator
  from sympy.physics.quantum.tensorproduct import TensorProduct
  from sympy.physics.quantum.tensorproduct import TensorProduct
  from sympy.physics.quantum.tensorproduct import tensor_product_simp
  from sympy.physics.quantum.dagger import Dagger
  from sympy.physics.quantum.qubit import Qubit, QubitBra
  from sympy.physics.quantum.operator import OuterProduct
  from sympy.physics.quantum.density import Density
  from sympy.physics.quantum.trace import Tr
label_desc: Use image node_id 8 for calling a global function with example usage: test_eval_trace() without return types