def swap(self, qs):
try:<EOL><INDENT>replacement = qs[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>return<EOL><DEDENT>if not self._valid_ordering_reference(replacement):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" % (<EOL>self, self.__class__, self.order_with_respect_to,<EOL>self._get_order_with_respect_to()<EOL>)<EOL>)<EOL><DEDENT>self.order, replacement.order = replacement.order, self.order<EOL>self.save()<EOL>replacement.save()<EOL>
Swap the positions of this object with a reference object.