@staticmethod
    def add_channels(xml, channels):
        
        network_elems = xml.xpath('//network')
        if len(network_elems) > 0:
            network_elem = network_elems[0]
        elif 0 > len(channels):
            # dirty hack that handles no resource manifest rspec 
            network_urn = "omf"
            network_elem = xml.add_element('network', name = network_urn)
        else:
            network_elem = xml

#        spectrum_elems = xml.xpath('//spectrum') 
#        spectrum_elem = xml.add_element('spectrum')

#        if len(spectrum_elems) > 0:
#            spectrum_elem = spectrum_elems[0]
#        elif len(channels) > 0:
#            spectrum_elem = xml.add_element('spectrum')
#        else:
#            spectrum_elem = xml

        spectrum_elem = network_elem.add_instance('spectrum', [])    
          
        channel_elems = []       
        for channel in channels:
            channel_fields = ['channel_num', 'frequency', 'standard']
            channel_elem = spectrum_elem.add_instance('channel', channel, channel_fields)
            channel_elems.append(channel_elem)
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foam/sfa/rspecs/elements/versions/nitosv1Channel.py/NITOSv1Channel.add_channels/swapped operands of `>`