def as_qubit_order(val: cirq.QubitOrderOrList) -> QubitOrder:
        """Converts a value into a basis.

        Args:
            val: An iterable or a basis.

        Returns:
            The basis implied by the value.

        Raises:
            ValueError: If `val` is not an iterable or a `QubitOrder`.
        """
        if isinstance(val, Iterable):
            return QubitOrder.explicit(val)
        if isinstance(val, QubitOrder):
            return val
        raise ValueError(f"Don't know how to interpret <{val}> as a Basis.")
Converts a value into a basis.

        Args:
            val: An iterable or a basis.

        Returns:
            The basis implied by the value.

        Raises:
            ValueError: If `val` is not an iterable or a `QubitOrder`.
        
cirq-core/cirq/ops/qubit_order.py