def cons(collection, value):
if isinstance(value, collections.Mapping):<EOL><INDENT>if collection is None:<EOL><INDENT>collection = {}<EOL><DEDENT>collection.update(**value)<EOL><DEDENT>elif isinstance(value, six.string_types):<EOL><INDENT>if collection is None:<EOL><INDENT>collection = []<EOL><DEDENT>collection.append(value)<EOL><DEDENT>elif isinstance(value, collections.Iterable):<EOL><INDENT>if collection is None:<EOL><INDENT>collection = []<EOL><DEDENT>collection.extend(value)<EOL><DEDENT>else:<EOL><INDENT>if collection is None:<EOL><INDENT>collection = []<EOL><DEDENT>collection.append(value)<EOL><DEDENT>return collection<EOL>
Extends a collection with a value.