def extend(self, iterable):
<EOL>if not hasattr(self, "<STR_LIT>") or self._dict is None:<EOL><INDENT>self._dict = {}<EOL><DEDENT>_dict = self._dict<EOL>current_length = len(self)<EOL>list.extend(self, iterable)<EOL>for i, obj in enumerate(islice(self, current_length, None),<EOL>current_length):<EOL><INDENT>the_id = obj.id<EOL>if the_id not in _dict:<EOL><INDENT>_dict[the_id] = i<EOL><DEDENT>else:<EOL><INDENT>self = self[:current_length]<EOL>self._check(the_id)<EOL>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % (str(the_id), i))<EOL><DEDENT><DEDENT>
extend list by appending elements from the iterable