def get_community_kernel(G, C: [frozenset]):
    """
    To get community kernels with most degrees.
    Parameters
    ----------
    G : graph
        An undirected graph.
    C : int
        #communities

    Returns
    -------
    kernels
    """
    area = []
    for i in range(len(G)):
        area.append(0)
    for i, cc in enumerate(C):
        for each_node in cc:
            area[each_node - 1] += 1 << i
    kernels = []
    cnt = 0
    for i in range(len(C)):
        mask = 1 << i
        cnt += 1
        q = []
        p = []
        for i in range(len(G)):
            if area[i] & mask == mask:
                q.append((G.degree[i + 1], i + 1))
        q.sort()
        q.reverse()
        for i in range(max(int(len(q) / 100), min(2, len(q)))):
            p.append(q[i][1])
        kernels.append(p)
    if len(kernels) < 2:
        print('ERROR: WE should have at least 2 communities.')
    for i in range(len(kernels)):
        if len(kernels[i]) == 0:
            print('Comunity %d is too small.' % i)
            return None
    return kernels
