docs: def tk_to_pyquil(circ: Circuit) -> Program:
      """
         Convert a :math:`\\mathrm{t|ket}\\rangle` :py:class:`Circuit` to a :py:class:`pyquil.Program` .
      
      :param circ: A circuit to be converted
  
      :return: The converted circuit
      """
      p = Program()
      ro = p.declare('ro', 'BIT', circ.n_qubits())
      grid = circ._int_routing_grid()
      qubits = _grid_to_qubits(grid)
      slices = []
      for s in grid:
          news = set()
          for pair in s:
              if pair[0]>-1:
                  news.add(pair[0])
          slices.append(news)
      for s in slices:
          for v in s:
              op = circ._unsigned_to_op(v)
              optype = op.get_type()
              if optype == OpType.Input or optype == OpType.Output:
                  continue
              elif optype == OpType.Measure:
                  p += Measurement(qubits[(v, 0)], ro[int(op.get_desc())])
                  continue
              try:
                  gatetype = _known_quil_gate_rev[optype]
              except KeyError as error:
                  raise NotImplementedError("Cannot convert tket Op to pyquil gate: " + op.get_name()) from error
              params = [p*PI for p in op.get_params()]
              g = Gate(gatetype, params, [qubits[(v,port)] for port in range(op.get_n_inputs())])
              p += g
      return p