<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_items(self, jid, *, node=None, require_fresh=False, timeout=None):
 """ Query the items of the specified entity. :param jid: The entity to query. :type jid: :class:`aioxmpp.JID` :param node: The node to query. :type node: :class:`str` or :data:`None` :param require_fresh: Boolean flag to discard previous caches. :type require_fresh: :class:`bool` :param timeout: Optional timeout for the response. :type timeout: :class:`float` :rtype: :class:`.xso.ItemsQuery` :return: Service discovery items of the `node` at `jid`. The arguments have the same semantics as with :meth:`query_info`, as does the caching and error handling. """

        key = jid, node

        if not require_fresh:
            try:
                request = self._items_pending[key]
            except KeyError:
                pass
            else:
                try:
                    return (yield from request)
                except asyncio.CancelledError:
                    pass

        request_iq = stanza.IQ(to=jid, type_=structs.IQType.GET)
        request_iq.payload = disco_xso.ItemsQuery(node=node)

        request = asyncio.ensure_future(
            self.client.send(request_iq)
        )

        self._items_pending[key] = request
        try:
            if timeout is not None:
                try:
                    result = yield from asyncio.wait_for(
                        request,
                        timeout=timeout)
                except asyncio.TimeoutError:
                    raise TimeoutError()
            else:
                result = yield from request
        except:  # NOQA
            if request.done():
                try:
                    pending = self._items_pending[key]
                except KeyError:
                    pass
                else:
                    if pending is request:
                        del self._items_pending[key]
            raise

        return result