import yaml def yaml_encode(data, indent=None, unicode=False): return yaml.dump(data, indent=indent, allow_unicode=not unicode, sort_keys=False) def yaml_decode(data): return yaml.load(data, Loader=yaml.CFullLoader)