def _IfdEntryFactory(stream_rdr, offset):
    """
    Return an |_IfdEntry| subclass instance containing the value of the
    directory entry at *offset* in *stream_rdr*.
    """
    ifd_entry_classes = {
        TIFF_FLD.ASCII:    _AsciiIfdEntry,
        TIFF_FLD.SHORT:    _ShortIfdEntry,
        TIFF_FLD.LONG:     _LongIfdEntry,
        TIFF_FLD.RATIONAL: _RationalIfdEntry,
    }
    field_type = stream_rdr.read_short(offset, 2)
    if field_type in ifd_entry_classes:
        entry_cls = ifd_entry_classes[field_type]
    else:
        entry_cls = _IfdEntry
    return entry_cls.from_stream(stream_rdr, offset)