def xtrim(self, name, maxlen, approximate=True):
        """
        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 = [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
        
stackoverflow/venv/lib/python3.6/site-packages/redis/client.py