def i_groupAttributeSet(ss: Substrate, attset: attributeSet) -> sctIdGroups_or_Error:
    lhs = i_groupSubAttributeSet(ss, attset.first)
    rhs = attset.second
    return lhs if rhs.is_empty else \
        gintersect(lhs, i_groupConjunctionAttributeSet(ss, rhs.head.attset_conjattset)) if rhs.head.inran(
            'attset_conjattset') else \
        gunion(lhs, i_groupDisjunctionAttributeSet(ss, rhs.head.attset_disjattset))
def i_groupConjunctionAttributeSet(ss: Substrate, conjset: conjunctionAttributeSet) -> sctIdGroups_or_Error:
    return i_groupSubAttributeSet(ss, conjset.head) if conjset.tail.is_empty else \
        gintersect(i_groupSubAttributeSet(ss, conjset.head), i_groupConjunctionAttributeSet(ss, conjset.tail))