Implements the high level loop of the algorithm for learning a
        Mealy machine.
        Args:
            mma (DFA): The input automaton
        Returns:
            MealyMachine: A string and a model for the Mealy machine to be learned.

def learn_dfa(self, mma=None):
        """
        Implements the high level loop of the algorithm for learning a
        Mealy machine.
        Args:
            mma (DFA): The input automaton
        Returns:
            MealyMachine: A string and a model for the Mealy machine to be learned.
        """
        logging.info('Initializing learning procedure.')
        if mma:
            self._init_table_from_dfa(mma)
        else:
            self._init_table()

        logging.info('Generating a closed and consistent observation table.')
        while True:

            closed = False
            # Make sure that the table is closed
            while not closed:
                logging.debug('Checking if table is closed.')
                closed, string = self.observation_table.is_closed()
                if not closed:
                    logging.debug('Closing table.')
                    self._ot_make_closed(string)
                else:
                    logging.debug('Table closed.')

            # Create conjecture

            dfa = self.get_dfa_conjecture()

            logging.info('Generated conjecture machine with %d states.',len(list(dfa.states)))

            # _check correctness
            logging.debug('Running equivalence query.')
            found, counter_example = self._equivalence_query(dfa)

            # Are we done?
            if found:
                logging.info('No counterexample found. Hypothesis is correct!')
                break

            # Add the new experiments into the table to reiterate the
            # learning loop
            logging.info('Processing counterexample %s with length %d.', counter_example, len(counter_example))
            self._process_counter_example(dfa, counter_example)

        logging.info('Learning complete.')
        logging.info('Learned em_vector table is the following:')
        logging.info(self.observation_table.em_vector)
        return '', dfa