title: Why does the Python MNIST parser hardcode the value "2051"?
body: <p>The variable <code>extract_path</code> is a mnist training file, and then I use gzip module to extract the data from that file, what makes me puzzled is that the variable <code>magic</code> value perhaps is 2051, what does 2051 means for?</p>
  
  <p>Second question for variable <code>bytestream</code>, it reads fours times, I don't know what it did that?</p>
  
  <pre><code>
      def _read32(bytestream):
          dt = np.dtype(np.uint32).newbyteorder('&gt;')
          return np.frombuffer(bytestream.read(4), dtype=dt)[0]
  
  
      with open(extract_path, 'rb') as f:
          with gzip.GzipFile(fileobj=f) as bytestream:
               magic = _read32(bytestream)
               if magic != 2051:
                  raise ValueError('Invalid magic number {} in file: {}'.format(magic, f.name))
               num_images = _read32(bytestream)
               rows = _read32(bytestream)
               cols = _read32(bytestream)
               buf = bytestream.read(rows * cols * num_images)
               data = np.frombuffer(buf, dtype=np.uint8)
               data = data.reshape(num_images, rows, cols)
  
  </code></pre>
  Any help is appreciated.