def baumwelch(bw, O, num_iter):
    """
    This convenience function runs the Baum--Welch algorithm in a way that looks
    similar to the C version of the library.

    Parameters
    ----------
    bw : baumwelch_t
         Specifies the context for the Baum--Welch algorithm.
    O : sequence of integers between 0 and M-1
        Specifies the sequence of observations for the Baum--Welch algorithm.

    Returns
    -------
    log_likelihood : float
                     Log-likelihood (base 2) of the sequence given the re-estimated HMM.
    lambda_ : hmm_t
              The re-estimated HMM.
    """
    return bw(O, num_iter)