def find_in_migration(self, anchor, needles, terminus='\n', distance=None):
        """Assert the presence of the given anchor in the output.

        Once the anchor is found, assert the presence of *each* provided
        needle within bounds. If `terminus` is provided, each needle must
        appear before the next instance of `terminus`.

        If `distance` is provided, each needle must appear within `distance`
        characters, and `terminus` is ignored.
        """
        # The anchor must exist. If it doesn't, we have another problem.
        assert anchor in self.migration_code, 'Could not find: %s\nIn: %s' % (
            anchor, self.migration_code,
        )
        start = self.migration_code.index(anchor) + len(anchor)

        # If a distance is provided, get the substring based on it.
        # Otherwise, use the terminus.
        if distance:
            block = self.migration_code[start:start + distance]
        else:
            try:
                end = self.migration_code.index(terminus, start)
            except __HOLE__:
                end = None
            block = self.migration_code[start:end]

        # Assert that each of my expected needles is found in the
        # given haystack.
        for needle in needles:
            assert needle in block, 'Could not find text:\n%s' % needle
dataset/ETHPy150Open lukesneeringer/django-pgfields/tests/south_migrations/tests.py/MigrationCreationSuite.find_in_migration