code: def take(self, stream, num):
          
          s = stream.read(num)
          slen = len(s)
          if slen != num:
              raise ReadError(
                  "Expected %d bytes but got %d bytes." % (num, slen)
              )
          return s
docs: Read the given number of bytes from the stream.
  
          :param stream:
              stream to read from
          :param num:
              number of bytes to read
          :raises ReadError:
              if the stream did not yield the exact number of bytes expected