def _export_entity(self, res, res_folder, export_files=False, export_thumb=False, backup=False):
    if backup:
        print('backup', res.name, 'to', res_folder)
    else:
        print('exporting', res.name, 'to', res_folder)
    if ((os.path.exists(res_folder) and (len(os.listdir(res_folder)) > 0)) and (not self._force)):
        raise ExportException((res_folder + ' already exists and is not empty.'))
    res.dump(res_folder)
    if export_files:
        files_folder = os.path.join(res_folder, 'files')
        ensure(files_folder)
        self._export_files_content(res, files_folder)
    if export_thumb:
        try:
            content = res.read_thumbnail_content()
            with open(os.path.join(res_folder, 'thumb'), 'wb') as f:
                f.write(content)
        except ApiException as e:
            if (e.code == 404):
                pass
            else:
                raise e
def _export_entity(self, res, res_folder, export_files=False, export_thumb=False, backup=False):
    if backup:
        print('backup', res.name, 'to', res_folder)
    else:
        print('exporting', res.name, 'to', res_folder)
    if ((os.path.exists(res_folder) and (len(os.listdir(res_folder)) > 0)) and (not self._force)):
        raise ExportException((res_folder + ' already exists and is not empty.'))
    res.dump(res_folder)
    if export_files:
        files_folder = os.path.join(res_folder, 'files')
        ensure(files_folder)
        self._export_files_content(res, files_folder)
    if export_thumb:
        try:
            content = res.read_thumbnail_content()
            with open(os.path.join(res_folder, 'thumb'), 'wb') as f:
                f.write(content)
        except ApiException as e:
            if (e.code == 404):
                pass
            else:
                raise e