def extend(self, *args, **kwargs):
if len(args) > <NUM_LIT:1>:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>".format(len(args)))<EOL><DEDENT>other = args[<NUM_LIT:0>] if len(args) >= <NUM_LIT:1> else ()<EOL>if isinstance(other, HTTPHeaderDict):<EOL><INDENT>for key, val in other.iteritems():<EOL><INDENT>self.add(key, val)<EOL><DEDENT><DEDENT>elif isinstance(other, Mapping):<EOL><INDENT>for key in other:<EOL><INDENT>self.add(key, other[key])<EOL><DEDENT><DEDENT>elif hasattr(other, "<STR_LIT>"):<EOL><INDENT>for key in other.keys():<EOL><INDENT>self.add(key, other[key])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for key, value in other:<EOL><INDENT>self.add(key, value)<EOL><DEDENT><DEDENT>for key, value in kwargs.items():<EOL><INDENT>self.add(key, value)<EOL><DEDENT>
Generic import function for any type of header-like object.
Adapted version of MutableMapping.update in order to insert items
with self.add instead of self.__setitem__