<｜begin▁of▁sentence｜>### Instruction:
As a network analyst working with the Political Blogs dataset, suppose a client has requested a community analysis to identify groups of political bloggers with similar political views and ages. The data is available in a GML file named polblogs.gml, and each node in the network has attributes such as 'political_view' and 'age'. The client is specifically interested in using the EVA algorithm to perform attributed community detection and then calculate the purity of the detected communities to understand how homogeneous they are in terms of political views and ages.
### Response:
from cdlib.algorithms import eva
from cdlib import evaluation
import networkx as nx
import random

# Create a random graph
G = nx.read_gml('polblogs.gml')

# Assuming nodes have attributes 'political_view' and 'age' for example purposes.
# In a real-case scenario, you should replace these with actual attributes present in your GML.
labels = {node: {'political_view': random.choice(['Left', 'Right']), 'age': random.choice(range(20, 70))} for node in G.nodes()}

# Applying EVA algorithm for attributed community detection
communities = eva(G, labels, alpha=0.5)

# Computing purity
pur = evaluation.purity(communities)

# Printing the purity result
print(pur)
<|EOT|>
