def convert_to_yaml(cfg, str_or_buffer):
    s = ordered_yaml(cfg)

    if not str_or_buffer:
        return s
    elif isinstance(str_or_buffer, str):
        with open(str_or_buffer, 'w') as f:
            f.write(s)
    else:
        str_or_buffer.write(s)
Convert a dictionary to YAML and return the string or write it out
dataset/ETHPy150Open UDST/urbansim/urbansim/utils/yamlio.py/convert_to_yaml