def xtrim(self, name: KeyT, maxlen: int, approximate: bool = True) -> Awaitable:
        """
        Trims old messages from a stream.
        name: name of the stream.
        maxlen: truncate old stream messages beyond this size
        approximate: actual stream length may be slightly more than maxlen
        """
        pieces: List[EncodableT] = [b"MAXLEN"]
        if approximate:
            pieces.append(b"~")
        pieces.append(maxlen)
        return self.execute_command("XTRIM", name, *pieces)

        Trims old messages from a stream.
        name: name of the stream.
        maxlen: truncate old stream messages beyond this size
        approximate: actual stream length may be slightly more than maxlen
        
aioredis/client.py