Decode variable integer using algorithm similar to that described
        in MQTT Version 3.1.1 line 297.

        Parameters
        ----------
        max_bytes: int or None
            If a varint cannot be constructed using `max_bytes` or fewer
            from f then raises a `DecodeError`.  If None then there is no
            maximum number of bytes.

        Raises
        -------
        DecodeError
            When length is greater than max_bytes.
        UnderflowDecodeError
            When file ends before enough bytes can be read to construct the
            varint.

        Returns
        -------
        int
            Number of bytes consumed.
        int
            Value extracted from `f`.

def unpack_varint(self, max_bytes):
        """Decode variable integer using algorithm similar to that described
        in MQTT Version 3.1.1 line 297.

        Parameters
        ----------
        max_bytes: int or None
            If a varint cannot be constructed using `max_bytes` or fewer
            from f then raises a `DecodeError`.  If None then there is no
            maximum number of bytes.

        Raises
        -------
        DecodeError
            When length is greater than max_bytes.
        UnderflowDecodeError
            When file ends before enough bytes can be read to construct the
            varint.

        Returns
        -------
        int
            Number of bytes consumed.
        int
            Value extracted from `f`.

        """
        num_bytes_consumed, value = decode_varint(self.__f, max_bytes)
        self.__num_bytes_consumed += num_bytes_consumed
        return num_bytes_consumed, value