code: def out(self):
          
          def format_matrix_element(element):
              """
              Formats a parameterized matrix element.
  
              :param element: {int, float, complex, str} The parameterized element to format.
              """
              if isinstance(element, integer_types) or isinstance(element, (float, complex, np.int_)):
                  return format_parameter(element)
              elif isinstance(element, string_types):
                  return element
              elif isinstance(element, Expression):
                  return str(element)
              else:
                  raise TypeError("Invalid matrix element: %r" % element)
  
          if self.parameters:
              result = "DEFGATE {}({}):\n".format(self.name, ', '.join(map(str, self.parameters)))
          else:
              result = "DEFGATE {}:\n".format(self.name)
  
          for row in self.matrix:
              result += "    "
              fcols = [format_matrix_element(col) for col in row]
              result += ", ".join(fcols)
              result += "\n"
          return result
docs: Prints a readable Quil string representation of this gate.
  
          :returns: String representation of a gate
          :rtype: string