def inner_problem_check(problems, done, verbosity):
    "Takes a set of possible problems and gets the actual issues out of it."
    result = []
    for last, migration in problems:
        checked = set([])
        # 'Last' is the last applied migration. Step back from it until we
        # either find nothing wrong, or we find something.
        to_check = list(last.dependencies)
        while to_check:
            checking = to_check.pop()
            if checking in checked:
                continue
            checked.add(checking)

            if checking not in done:
                # That's bad. Error.
                if verbosity:
                    print((" ! Migration %s should not have been applied "
                           "before %s but was." % (last, checking)))
                result.append((last, checking))
            else:
                to_check.extend(checking.dependencies)
    return result
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/__init__.py/inner_problem_check/original