@staticmethod<EOL><INDENT>def _componentSortKey(componentAndType):<DEDENT>
component, asn1Spec = componentAndType<EOL>if asn1Spec is None:<EOL><INDENT>compType = component<EOL><DEDENT>else:<EOL><INDENT>compType = asn1Spec<EOL><DEDENT>if compType.typeId == univ.Choice.typeId and not compType.tagSet:<EOL><INDENT>if asn1Spec is None:<EOL><INDENT>return component.getComponent().tagSet<EOL><DEDENT>else:<EOL><INDENT>names = [namedType.name for namedType in asn1Spec.componentType.namedTypes<EOL>if namedType.name in component]<EOL>if len(names) != <NUM_LIT:1>:<EOL><INDENT>raise error.PyAsn1Error(<EOL>'<STR_LIT>' % (len(names) and '<STR_LIT>' or '<STR_LIT>', component))<EOL><DEDENT>return asn1Spec[names[<NUM_LIT:0>]].tagSet<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return compType.tagSet<EOL><DEDENT>
Sort SET components by tag

        Sort depending on the actual Choice value (dynamic sort)