Read at most `max_bytes` from internal buffer.

        Parameters
        -----------
        max_bytes: int
            Maximum number of bytes to read.

        Returns
        --------
        bytes
            Bytes extracted from internal buffer.  Length may be less
            than ``max_bytes``.  On end-of file returns a bytes object
            with zero-length.

def read(self, max_bytes=1):
        """Read at most `max_bytes` from internal buffer.

        Parameters
        -----------
        max_bytes: int
            Maximum number of bytes to read.

        Returns
        --------
        bytes
            Bytes extracted from internal buffer.  Length may be less
            than ``max_bytes``.  On end-of file returns a bytes object
            with zero-length.
        """

        if self.limit is None:
            b = self.__f.read(max_bytes)
        else:
            if self.__num_bytes_consumed + max_bytes > self.limit:
                max_bytes = self.limit - self.__num_bytes_consumed
            b = self.__f.read(max_bytes)
        self.__num_bytes_consumed += len(b)

        return b