docs: def with_device(
              self,
              new_device: devices.Device,
              qubit_mapping: Callable[[ops.Qid], ops.Qid] = lambda e: e,
      ) -> 'Circuit':
          """Maps the current circuit onto a new device, and validates.
  
          Args:
              new_device: The new device that the circuit should be on.
              qubit_mapping: How to translate qubits from the old device into
                  qubits on the new device.
  
          Returns:
              The translated circuit.
          """
          return Circuit(
              moments=[ops.Moment(operation.transform_qubits(qubit_mapping)
                              for operation in moment.operations)
                       for moment in self._moments],
              device=new_device
          )