def _merge(self, key, value):
method = self._merge_method(key)<EOL>if method is not None:<EOL><INDENT>if method == "<STR_LIT>" and is_str(value):<EOL><INDENT>value = [value]<EOL><DEDENT>if (<EOL>method == "<STR_LIT>"<EOL>and isinstance(self[key], list)<EOL>and isinstance(value, list)<EOL>):<EOL><INDENT>method = "<STR_LIT>"<EOL><DEDENT>getattr(self[key], method)(value)<EOL><DEDENT>else:<EOL><INDENT>super(MergingDict, self).__setitem__(key, value)<EOL><DEDENT>
Internal merge logic implementation to allow merging of values when
setting attributes/items.

:param key: Attribute name or item key
:type key: str
:param value: Value to set attribute/item as.
:type value: object
:rtype: None