[docs]defdumps(self,element:Union[BaseModel,YAMLRoot],**kwargs)->str:"""Return element formatted as a YAML string"""# Internal note: remove_empty_items will also convert Decimals to int/float;# this is necessary until https://github.com/yaml/pyyaml/pull/372 is mergeddumper_safe_element=element.model_dump()ifisinstance(element,BaseModel)elseelementreturnyaml.dump(remove_empty_items(dumper_safe_element,hide_protected_keys=True),Dumper=yaml.SafeDumper,sort_keys=False,allow_unicode=True,**kwargs,)