<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _completed_families(self, reference_name, rightmost_boundary):
        '''returns one or more families whose end < rightmost boundary'''
        in_progress = self._right_coords_in_progress[reference_name]
        while len(in_progress):
            right_coord = in_progress[0]
            if right_coord < rightmost_boundary:
                in_progress.pop(0)
                left_families = self._coordinate_family.pop((reference_name, right_coord), {})
                for family in sorted(left_families.values(),
                                     key=lambda x:x[0].left.reference_start):
                    family.sort(key=lambda x: x.query_name)
                    self.pending_pair_count -= len(family)
                    yield family
            else:
                break