code: def read_source_groups(fname):
      
      smodel = nrml.read(fname).sourceModel
      src_groups = []
      if smodel[0].tag.endswith('sourceGroup'):  # NRML 0.5 format
          for sg_node in smodel:
              sg = SourceGroup(sg_node['tectonicRegion'])
              sg.sources = sg_node.nodes
              src_groups.append(sg)
      else:  # NRML 0.4 format: smodel is a list of source nodes
          src_groups.extend(SourceGroup.collect(smodel))
      return src_groups
docs: :param fname: a path to a source model XML file
      :return: a list of SourceGroup objects containing source nodes