def get_typed_tag_value_from_file(path, options):
    path = expandpath(path)
    mime = options.mime[0] if options.mime else None
    if os.path.exists(path):
        v = Dummy()
        stem, ext = os.path.splitext(path)
        ext = ext[1:].lower()
        if (mime and mime in TEXTUAL_MIMES.values()) or ext in TEXTUAL_MIMES:
            f = open(path)
            v.value = f.read()
            f.close()
            try:
                v.value = v.value.decode('UTF-8')
            except __HOLE__:      # clearly wasn't UTF-8
                raise UnicodeError('Content doesn\'t seem to be UTF-8')
            v.mime = mime or TEXTUAL_MIMES[ext]
        elif mime or ext in BINARY_MIMES:
            f = open(path, 'rb')
            v.value = f.read()
            f.close()
            v.mime = mime or BINARY_MIMES[ext]
            
        else:
            if ext:
                raise MIMEError('Extension .%s unknown and no MIME type'
                                ' given (with -M)' % ext)
            else:
                raise MIMEError('You need to specify a MIME type with -M for'
                                'files with no Extension.')
        return v
    else:
        raise FileNotFoundError('Could not find or read %s.' % path)
dataset/ETHPy150Open njr0/fish/fish/fishlib.py/get_typed_tag_value_from_file