def join(self, other):
if self.source_buffer != other.source_buffer:<EOL><INDENT>raise ValueError<EOL><DEDENT>if self.expanded_from == other.expanded_from:<EOL><INDENT>expanded_from = self.expanded_from<EOL><DEDENT>else:<EOL><INDENT>expanded_from = None<EOL><DEDENT>return Range(self.source_buffer,<EOL>min(self.begin_pos, other.begin_pos),<EOL>max(self.end_pos, other.end_pos),<EOL>expanded_from=expanded_from)<EOL>
Returns the smallest possible range spanning both this range and other.
Raises :exc:`ValueError` if the ranges do not belong to the same
:class:`Buffer`.