def to_cirq_result(self, params: cirq.ParamResolver | None = None) -> cirq.Result:
        """Returns a `cirq.Result` for these results.

        `cirq.Result` contains a less dense representation of results than that returned by
        the IonQ API.  Typically these results are also ordered by when they were run, though
        that contract is implicit.  Because the IonQ API does not retain that ordering information,
        the order of these `cirq.Result` objects should *not* be interpetted as representing the
        order in which the circuit was repeated. Correlations between measurements keys are
        preserved.

        Args:
            params: The `cirq.ParamResolver` used to generate these results.

        Returns:
            The `cirq.Result` for these results.

        Raises:
            ValueError: If the circuit used to produce this result had no measurement gates
                (and hence no measurement keys).
        """
        if len(self.measurement_dict()) == 0:
            raise ValueError(
                'Can convert to cirq results only if the circuit had measurement gates '
                'with measurement keys.'
            )
        measurements = {}
        for key, targets in self.measurement_dict().items():
            qpu_results = self.ordered_results(key)
            measurements[key] = np.array(
                list(cirq.big_endian_int_to_bits(x, bit_count=len(targets)) for x in qpu_results)
            )
        return cirq.ResultDict(params=params or cirq.ParamResolver({}), measurements=measurements)
Returns a `cirq.Result` for these results.

        `cirq.Result` contains a less dense representation of results than that returned by
        the IonQ API.  Typically these results are also ordered by when they were run, though
        that contract is implicit.  Because the IonQ API does not retain that ordering information,
        the order of these `cirq.Result` objects should *not* be interpetted as representing the
        order in which the circuit was repeated. Correlations between measurements keys are
        preserved.

        Args:
            params: The `cirq.ParamResolver` used to generate these results.

        Returns:
            The `cirq.Result` for these results.

        Raises:
            ValueError: If the circuit used to produce this result had no measurement gates
                (and hence no measurement keys).
        
cirq-ionq/cirq_ionq/results.py