def get_traitset_map(pop):
    """
    Utility method which returns a map of culture ID's (hashes) and the trait set
     corresponding to a random individual of that culture (actually, the first one
     we encounter).
    """
    traitsets = {}
    graph = pop.agentgraph
    for nodename in graph.nodes():
        traits = graph.node[nodename]['traits']
        culture = pop.get_traits_packed(traits)
        if culture not in traitsets:
            traitsets[culture] = traits
    return traitsets