'Initialize an ImageFileDirectory.
To construct an ImageFileDirectory from a real file, pass the 8-byte
magic header to the constructor.  To only set the endianness, pass it
as the \'prefix\' keyword argument.
:param ifh: One of the accepted magic headers (cf. PREFIXES); also sets
endianness.
:param prefix: Override the endianness of the file.'

def __init__(self, ifh='II*\x00\x00\x00\x00\x00', prefix=None):

    if (ifh[:4] not in PREFIXES):
        raise SyntaxError(('not    a    TIFF    file    (header    %r    not    valid)' % ifh))
    self._prefix = (prefix if (prefix is not None) else ifh[:2])
    if (self._prefix == MM):
        self._endian = '>'
    elif (self._prefix == II):
        self._endian = '<'
    else:
        raise SyntaxError('not    a    TIFF    IFD')
    self.reset()
    (self.next,) = self._unpack('L', ifh[4:])
    self._legacy_api = False
