code: def _gate_name(self, gate):
          
          try:
              name = gate.tex_str()
          except AttributeError:
              name = str(gate)
          return name
docs: Return the string representation of the gate.
  
          Tries to use gate.tex_str and, if that is not available, uses str(gate)
          instead.
  
          :param string gate: Gate object of which to get the name / LaTeX representation.
          :return: LaTeX gate name.
          :rtype: string