def combined_levels(dimensions, default_only=False):
 groups = []
 for dim in dimensions:
  if default_only:
   levels = dim.hierarchy().levels
  else:
   levels = dim.levels
  group = [(str(dim), str(level)) for level in levels]
  groups.append(group)
 return tuple(itertools.product(*groups))

def combined_levels ( dimensions , default_only = False ) : groups = [ ] for dim in dimensions : if default_only : levels = dim . hierarchy ( ) . levels else : levels = dim . levels group = [ ( str ( dim ) , str ( level ) ) for level in levels ] groups . append ( group ) return tuple ( itertools . product ( * groups ) )
create a cartesian product of levels from all dimensions .