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

        Args:
            val: An iterable or a basis.

        Returns:
            The basis implied by the value.
        """
        if isinstance(val, collections.Iterable):
            return QubitOrder.explicit(val)
        if isinstance(val, QubitOrder):
            return val
        raise ValueError(
            "Don't know how to interpret <{}> as a Basis.".format(val))
Converts a value into a basis.

        Args:
            val: An iterable or a basis.

        Returns:
            The basis implied by the value.