[docs]defconfigure_converter(converter:BaseConverter)->None:""" Configure the converter for use with the pyyaml library. * frozensets are serialized as lists * string enums are converted into strings explicitly * datetimes and dates are validated * typed namedtuples are serialized as lists .. versionchanged:: 24.1.0 Add support for typed namedtuples. """converter.register_unstructure_hook(str,lambdav:vifv.__class__isstrelsev.value)# datetime inherits from date, so identity unstructure hook used# here to prevent the date unstructure hook running.converter.register_unstructure_hook(datetime,lambdav:v)converter.register_structure_hook(datetime,validate_datetime)converter.register_structure_hook(date,validate_date)converter.register_unstructure_hook_factory(is_namedtuple)(partial(namedtuple_unstructure_factory,unstructure_to=tuple))configure_union_passthrough(Union[str,bool,int,float,None,bytes,datetime,date],converter)