code: def get_cim_ns(namespaces):
      
      try:
          ns = namespaces['cim']
          if ns.endswith('#'):
              ns = ns[:-1]
      except KeyError:
          ns = ''
          logger.error('No CIM namespace defined in input file.')
  
      CIM16nsURI = 'http://iec.ch/TC57/2013/CIM-schema-cim16'
  
      nsuri = ns
  
      import CIM14, CIM15
      if ns == CIM14.nsURI:
          ns = 'CIM14'
      elif ns == CIM15.nsURI:
          ns = 'CIM15'
      elif ns == CIM16nsURI:
          ns  = 'CIM15'
      else:
          ns = 'CIM15'
          logger.warn('Could not detect CIM version. Using %s.' % ns)
  
      cim = __import__(ns, globals(), locals(), ['nsURI', 'packageMap'])
  
      return nsuri, cim.packageMap
docs: Tries to obtain the CIM version from the given map of namespaces and
      returns the appropriate *nsURI* and *packageMap*.