def apply_dict_default(dictionary, arg, default):
if arg not in dictionary:<EOL><INDENT>if hasattr(default, '<STR_LIT>'):<EOL><INDENT>default = restrict_args(default, arg)<EOL><DEDENT>dictionary[arg] = default<EOL><DEDENT>return dictionary<EOL>
Used to avoid generating a defaultdict object, or assigning defaults to a dict-like object

apply_dict_default({}, 'test', list)
# => {'test': []}

apply_dict_default({'test': 'ok'}, 'test', list)
# => {'test': 'ok'}