<｜begin▁of▁sentence｜>### Instruction:
Given a graph 'g', after performing community detection using the 'community_fastgreedy' method which produces a dendrogram, can you use the 'optimal_count' attribute from the 'VertexDendrogram' class in igraph to find the optimal count of communities?
### Response:
from igraph import Graph
from igraph import VertexDendrogram

# Assuming 'g' is an existing igraph Graph object
# and a community detection method has been applied
# such as community_fastgreedy resulting in a dendrogram

# Perform community detection
dendrogram = g.community_fastgreedy()

# Convert into a VertexDendrogram object
dendro = VertexDendrogram(g, dendrogram)

# Get the optimal count of communities
optimal_count = dendro.optimal_count

print('Optimal count of communities:', optimal_count)
<|EOT|>
