def make_consensus_matrix(com_membership, th=0.5):
    r"""
    Makes the consensus matrix
.
    Parameters
    ----------

    com_membership : array
        Shape should be node, time, iteration.

    th : float
        threshold to cancel noisey edges

    Returns
    -------

    D : array
        consensus matrix
    """

    com_membership = np.array(com_membership)
    D = []
    for i in range(com_membership.shape[0]):
        for j in range(i+1, com_membership.shape[0]):
            con = np.sum((com_membership[i, :] - com_membership[j, :])
                         == 0, axis=-1) / com_membership.shape[-1]
            twhere = np.where(con > th)[0]
            D += list(zip(*[np.repeat(i, len(twhere)).tolist(), np.repeat(j,
                        len(twhere)).tolist(), twhere.tolist(), con[twhere].tolist()]))
    if len(D) > 0:
        D = pd.DataFrame(D, columns=['i', 'j', 't', 'weight'])
        D = TemporalNetwork(from_df=D)
        D = create_supraadjacency_matrix(D, intersliceweight=0)
        Dnx = tnet_to_nx(D)
    else:
        Dnx = None
    return Dnx
r"""
    Makes the consensus matrix
.
    Parameters
    ----------

    com_membership : array
        Shape should be node, time, iteration.

    th : float
        threshold to cancel noisey edges

    Returns
    -------

    D : array
        consensus matrix