def _parse_migrate_output(self, output):
        """
        Args:
            output: str, output of "manage.py migrate"
        Returns (succeeded: list(tuple), failed: tuple or None)
        Both tuples are of the form (app, migration)
        """
        failed = None
        succeeded = []

        # Mark migrations:
        # - before exception migration as success
        # - exception migration as failed
        for line in output.split('\n'):
            line = _remove_escape_characters(line).strip()
            line_match = self.migration_regex.match(line)
            if line_match:
                migration = (line_match.group('app_name'), line_match.group('migration_name'))
                if line_match.group('success') == 'OK':
                    # The migration succeeded
                    succeeded.append(migration)
                else:
                    # The migration failed
                    failed = migration
                    break
        return succeeded, failed
Args:
            output: str, output of "manage.py migrate"
        Returns (succeeded: list(tuple), failed: tuple or None)
        Both tuples are of the form (app, migration)