code: def _load(content_or_fp):
      
      try:
          data = yaml.load(content_or_fp, Loader=yaml.loader.BaseLoader)
      except Exception as e:
          raise type(e)('Malformed yaml file:\n%r' % format_exc())
  
      try:
          ver = data['spec']
      except:
          raise ValueError('The file does not specify a spec version')
  
      try:
          ver = tuple(map(int, (ver.split("."))))
      except:
          raise ValueError("Invalid spec version format. Expect 'X.Y'"
                           " (X and Y integers), found %s" % ver)
  
      if ver > SPEC_VERSION_TUPLE:
          raise ValueError('The spec version of the file is '
                           '%s but the parser is %s. '
                           'Please update pyvisa-sim.' % (ver, SPEC_VERSION))
  
      return data
docs: YAML Parse a file or str and check version.