def gensim_corpus_to_dtm(corpus):
    """
    Convert a Gensim corpus object to a sparse DTM in COO format.

    .. seealso:: :func:`~tmtoolkit.bow.dtm.dtm_to_gensim_corpus` for the reverse function.

    :param corpus: Gensim corpus object
    :return: sparse DTM in COO format
    """
    import gensim
    from scipy.sparse import coo_matrix
    dtm_t = gensim.matutils.corpus2csc(corpus)
    return coo_matrix(dtm_t.transpose())
