code: def get_ndmapping_label(ndmapping, attr):
      
      label = None
      els = itervalues(ndmapping.data)
      while label is None:
          try:
              el = next(els)
          except StopIteration:
              return None
          if not getattr(el, '_auxiliary_component', True):
              label = getattr(el, attr)
      if attr == 'group':
          tp = type(el).__name__
          if tp == label:
              return None
      return label
docs: Function to get the first non-auxiliary object
      label attribute from an NdMapping.