def calendar_hierarchy_units(hierarchy):
 units = []
 for level in hierarchy.levels:
  role = (level.role or level.name)
  if (role in _CALENDAR_UNITS):
   units.append(role)
  else:
   raise ArgumentError(("Unknown time role '%s' for level '%s'" % (role, str(level))))
 return units

def calendar_hierarchy_units ( hierarchy ) : units = [ ] for level in hierarchy . levels : role = ( level . role or level . name ) if ( role in _CALENDAR_UNITS ) : units . append ( role ) else : raise ArgumentError ( ( "Unknown time role '%s' for level '%s'" % ( role , str ( level ) ) ) ) return units
return time units for levels in the hierarchy .