Search for a given flag in a given blockette for the current record.

This is a utility function for set_flags_in_fixed_headers and is not designed to be called by someone else.

This function checks for valid entries for a flag. A flag can be either * bool value to be always True or False for all the records * datetime or UTCDateTime value to add a single ‘INSTANT’ datation (see below) * dict to allow complex flag datation ** The dict keys may be the keyword INSTANT to mark arbitrarly short duration flags, or the keyword DURATION to mark events that span across time. ** The dict values are: * for the INSTANT value, a single UTCDateTime or datetime object, or a list of these datation objects * for the DURATION value, either a list of [start1, end1, start2, end2, ...] or a list of tuples [(start1, end1), (start2, end2), ...]

This function then returns all datation events as a list of tuples [(start1, end1), ...] to ease the work of _convert_flags_to_raw_byte. Bool values are unchanged, instant events become a tuple (event_date, event_date).

If the flag value is incorrect, a ValueError is raised with a (hopefully) explicit enough message.

Parameters:flag_value (bool or dict) the flag value to check.
Returns:corrected value of the flag.
Raises:If the flag is not the one expected, a ValueError is raised