def oqi(ql, qs, ns=None, rc=None, ot=None, coe=None, moc=None):
    """
    This function is a wrapper for
    :meth:`~pywbem.WBEMConnection.OpenQueryInstances`.

    Open an enumeration session to execute a query in a namespace and to
    retrieve the instances representing the query result.

    Use the :func:`~wbemcli.pi` function to retrieve the next set of
    instances or the :func:`~wbcmeli.ce` function to close the enumeration
    session before it is complete.

    Parameters:

      ql (:term:`string`):
          Filter query language to be used for the filter defined in the `q`
          parameter, e.g. "DMTF:CQL" for CIM Query Language, and "WQL" for WBEM
          Query Language. Because this is not a filter query, "DMTF:FQL" is not
          a valid query language for this request.

      qs (:term:`string`):
          Filter to apply to objects to be returned. Based on filter query
          language defined by the `ql` parameter.

      ns (:term:`string`):
          Name of the CIM namespace to be used (case independent).

          If `None`, defaults to the default namespace of the connection.

      rc (:class:`py:bool`):
          Controls whether a class definition describing the properties of the
          returned instances will be returned.

          `None` will cause the server to use its default of `False`.

      ot (:class:`~pywbem.Uint32`):
          Operation timeout in seconds. This is the minimum time the WBEM server
          must keep the enumeration session open between requests on that
          session.

          A value of 0 indicates that the server should never time out.

          The server may reject the proposed value.

          `None` will cause the server to use its default timeout.

      coe (:class:`py:bool`):
          Continue on error flag.

          `None` will cause the server to use its default of `False`.

      moc (:class:`~pywbem.Uint32`):
          Maximum number of objects to return for this operation.

          `None` will cause the server to use its default of 0.

    Returns:

      A :func:`~py:collections.namedtuple` object containing the following
      named items:

        * **instances** (list of :class:`~pywbem.CIMInstance`):
          The retrieved instances.

        * **eos** (:class:`py:bool`):
          `True` if the enumeration session is exhausted after this operation.
          Otherwise `eos` is `False` and the `context` item is the context
          object for the next operation on the enumeration session.

        * **context** (:func:`py:tuple` of server_context, namespace):
          A context object identifying the open enumeration session, including
          its current enumeration state, and the namespace. This object must be
          supplied with the next pull or close operation for this enumeration
          session.

        * **query_result_class** (:class:`~pywbem.CIMClass`):
          Result class definition describing the properties of the returned
          instances if requested, or otherwise `None`.
    """

    return CONN.OpenQueryInstances(FilterQueryLanguage=ql,
                                   FilterQuery=qs,
                                   namespace=ns,
                                   ReturnQueryResultClass=rc,
                                   OperationTimeout=ot,
                                   ContinueOnError=coe,
                                   MaxObjectCount=moc)