code: def qubit_to_matrix(qubit, format="sympy"):
      """Converts an Add/Mul of Qubit objects into it's matrix representation
  
      This function is the inverse of ``matrix_to_qubit`` and is a shorthand
      for ``represent(qubit)``.
      """
      return represent(qubit, format=format)
  
imports: import math
  from sympy.core.add import Add
  from sympy.core.mul import Mul
  from sympy.core.numbers import Integer
  from sympy.core.power import Pow
  from sympy.core.singleton import S
  from sympy.functions.elementary.complexes import conjugate
  from sympy.functions.elementary.exponential import log
  from sympy.core.basic import _sympify
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.matrices import Matrix, zeros
  from sympy.printing.pretty.stringpict import prettyForm
  from sympy.physics.quantum.hilbert import ComplexSpace
  from sympy.physics.quantum.state import Ket, Bra, State
  from sympy.physics.quantum.qexpr import QuantumError
  from sympy.physics.quantum.represent import represent
  from sympy.physics.quantum.matrixutils import numpy_ndarray, scipy_sparse_matrix
  from mpmath.libmp.libintmath import bitcount
label_desc: Use image node_id 3 for calling a global function with example usage: qubit_to_matrix(qubit, format) and returns: represent