<｜begin▁of▁sentence｜>### Instruction:
Given the Political blogs dataset, which can be read from a GML file named polblogs.gml, how can you use the K-Cut function in cdlib to perform community detection with a maximum of 4 communities? Please print out the list of nodes for each detected community.
### Response:
import networkx as nx
from cdlib import algorithms

# Create a graph from the Political blogs dataset
G = nx.read_gml('polblogs.gml')

# Apply the K-Cut community detection algorithm
communities = algorithms.kcut(G, kmax=4)

# Print the communities
for community in communities.communities:
    print(community)
<|EOT|>
