def read_file_header(fd, endian):
fields = [<EOL>('<STR_LIT:description>', '<STR_LIT:s>', <NUM_LIT>),<EOL>('<STR_LIT>', '<STR_LIT:s>', <NUM_LIT:8>),<EOL>('<STR_LIT:version>', '<STR_LIT:H>', <NUM_LIT:2>),<EOL>('<STR_LIT>', '<STR_LIT:s>', <NUM_LIT:2>)<EOL>]<EOL>hdict = {}<EOL>for name, fmt, num_bytes in fields:<EOL><INDENT>data = fd.read(num_bytes)<EOL>hdict[name] = unpack(endian, fmt, data)<EOL><DEDENT>hdict['<STR_LIT:description>'] = hdict['<STR_LIT:description>'].strip()<EOL>v_major = hdict['<STR_LIT:version>'] >> <NUM_LIT:8><EOL>v_minor = hdict['<STR_LIT:version>'] & <NUM_LIT><EOL>hdict['<STR_LIT>'] = '<STR_LIT>' % (v_major, v_minor)<EOL>return hdict<EOL>
Read mat 5 file header of the file fd.
    Returns a dict with header values.