def xpending_range(
        self,
        name: KeyT,
        groupname: GroupT,
        min: Optional[StreamIdT],
        max: Optional[StreamIdT],
        count: Optional[int],
        consumername: Optional[ConsumerT] = None,
    ) -> Awaitable:
        """
        Returns information about pending messages, in a range.
        name: name of the stream.
        groupname: name of the consumer group.
        min: minimum stream ID.
        max: maximum stream ID.
        count: number of messages to return
        consumername: name of a consumer to filter by (optional).
        """
        pieces: List[EncodableT] = [name, groupname]
        if min is not None or max is not None or count is not None:
            if min is None or max is None or count is None:
                raise DataError(
                    "XPENDING must be provided with min, max "
                    "and count parameters, or none of them. "
                )
            if not isinstance(count, int) or count < -1:
                raise DataError("XPENDING count must be a integer >= -1")
            pieces.extend((min, max, str(count)))
        if consumername is not None:
            if min is None or max is None or count is None:
                raise DataError(
                    "if XPENDING is provided with consumername,"
                    " it must be provided with min, max and"
                    " count parameters"
                )
            pieces.append(consumername)
        return self.execute_command("XPENDING", *pieces, parse_detail=True)

        Returns information about pending messages, in a range.
        name: name of the stream.
        groupname: name of the consumer group.
        min: minimum stream ID.
        max: maximum stream ID.
        count: number of messages to return
        consumername: name of a consumer to filter by (optional).
        
aioredis/client.py