def get_extent(self, filename, locations):
f = self.get_file(filename)<EOL>if len(locations) < <NUM_LIT:2>:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>start_location, end_location = locations<EOL>if hasattr(start_location, '<STR_LIT>'):<EOL><INDENT>start_location = SourceLocation.from_position(self, f,<EOL>start_location[<NUM_LIT:0>], start_location[<NUM_LIT:1>])<EOL><DEDENT>elif isinstance(start_location, int):<EOL><INDENT>start_location = SourceLocation.from_offset(self, f,<EOL>start_location)<EOL><DEDENT>if hasattr(end_location, '<STR_LIT>'):<EOL><INDENT>end_location = SourceLocation.from_position(self, f,<EOL>end_location[<NUM_LIT:0>], end_location[<NUM_LIT:1>])<EOL><DEDENT>elif isinstance(end_location, int):<EOL><INDENT>end_location = SourceLocation.from_offset(self, f, end_location)<EOL><DEDENT>assert isinstance(start_location, SourceLocation)<EOL>assert isinstance(end_location, SourceLocation)<EOL>return SourceRange.from_locations(start_location, end_location)<EOL>
Obtain a SourceRange from this translation unit.

        The bounds of the SourceRange must ultimately be defined by a start and
        end SourceLocation. For the locations argument, you can pass:

          - 2 SourceLocation instances in a 2-tuple or list.
          - 2 int file offsets via a 2-tuple or list.
          - 2 2-tuple or lists of (line, column) pairs in a 2-tuple or list.

        e.g.

        get_extent('foo.c', (5, 10))
        get_extent('foo.c', ((1, 1), (1, 15)))