docs: def get_vulnerability_functions_05(node, fname):
      """
      :param node:
          a vulnerabilityModel node
      :param fname:
          path of the vulnerability filter
      :returns:
          a dictionary imt, vf_id -> vulnerability function
      """
      # NB: the IMTs can be duplicated and with different levels, each
      # vulnerability function in a set will get its own levels
      vf_ids = set()
      vmodel = scientific.VulnerabilityModel(**node.attrib)
      # imt, vf_id -> vulnerability function
      for vfun in node.getnodes('vulnerabilityFunction'):
          with context(fname, vfun):
              imt = vfun.imls['imt']
              imls = numpy.array(~vfun.imls)
              vf_id = vfun['id']
          if vf_id in vf_ids:
              raise InvalidFile(
                  'Duplicated vulnerabilityFunctionID: %s: %s, line %d' %
                  (vf_id, fname, vfun.lineno))
          vf_ids.add(vf_id)
          num_probs = None
          if vfun['dist'] == 'PM':
              loss_ratios, probs = [], []
              for probabilities in vfun[1:]:
                  loss_ratios.append(probabilities['lr'])
                  probs.append(valid.probabilities(~probabilities))
                  if num_probs is None:
                      num_probs = len(probs[-1])
                  elif len(probs[-1]) != num_probs:
                      raise ValueError(
                          'Wrong number of probabilities (expected %d, '
                          'got %d) in %s, line %d' %
                          (num_probs, len(probs[-1]), fname,
                           probabilities.lineno))
              all_probs = numpy.array(probs)
              assert all_probs.shape == (len(loss_ratios), len(imls)), (
                  len(loss_ratios), len(imls))
              vmodel[imt, vf_id] = (
                  scientific.VulnerabilityFunctionWithPMF(
                      vf_id, imt, imls, numpy.array(loss_ratios),
                      all_probs))
              # the seed will be set by readinput.get_risk_model
          else:
              with context(fname, vfun):
                  loss_ratios = ~vfun.meanLRs
                  coefficients = ~vfun.covLRs
              if len(loss_ratios) != len(imls):
                  raise InvalidFile(
                      'There are %d loss ratios, but %d imls: %s, line %d' %
                      (len(loss_ratios), len(imls), fname,
                       vfun.meanLRs.lineno))
              if len(coefficients) != len(imls):
                  raise InvalidFile(
                      'There are %d coefficients, but %d imls: %s, '
                      'line %d' % (len(coefficients), len(imls), fname,
                                   vfun.covLRs.lineno))
              with context(fname, vfun):
                  vmodel[imt, vf_id] = scientific.VulnerabilityFunction(
                      vf_id, imt, imls, loss_ratios, coefficients,
                      vfun['dist'])
      return vmodel