def safe_dump(data, stream=None, **kwds):
    # type: (Any, Optional[StreamType], Any) -> Optional[str]
    """
    Serialize a Python object into a YAML stream.
    Produce only basic YAML tags.
    If stream is None, return the produced string instead.
    """
    return dump_all([data], stream, Dumper=SafeDumper, **kwds)

    Serialize a Python object into a YAML stream.
    Produce only basic YAML tags.
    If stream is None, return the produced string instead.
    
dynaconf/vendor/ruamel/yaml/main.py