@contextmanager<EOL>def safe_change_dju_settings():
settings_bak = {}<EOL>for k, v in dju_settings.__dict__.iteritems():<EOL><INDENT>if k[:<NUM_LIT:4>] == '<STR_LIT>':<EOL><INDENT>settings_bak[k] = copy.deepcopy(v)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>yield<EOL><DEDENT>finally:<EOL><INDENT>for k, v in settings_bak.iteritems():<EOL><INDENT>setattr(dju_settings, k, v)<EOL><DEDENT>clear_profile_configs_cache()<EOL><DEDENT>
with safe_change_dju_settings():
    dju_settings.DJU_IMG_UPLOAD_PROFILE_DEFAULT['TYPES'] = ('PNG',)
    ...
# dju settings will be restored
...