def gen_enoslib_roles(resources_or_topology):
    """Generator for the resources or topology."""
    for k1, v1 in resources_or_topology.items():
        for k2, v2 in v1.items():
            if isinstance(v2, dict):
                for k3, v3 in v2.items():
                    yield {'group': k1, 'role': k3, 'flavor': k2, 'number': v3}
            else:
                yield {'group': 'default_group', 'role': k2, 'flavor': k1,
                    'number': v2}
