code: def _validate_magic_line(line):
      
  
      if not line.startswith('NRRD'):
          raise NRRDError('Invalid NRRD magic line. Is this an NRRD file?')
  
      try:
          version = int(line[4:])
          if version > 5:
              raise NRRDError('Unsupported NRRD file version (version: %i). This library only supports v%i and below.'
                              % (version, 5))
      except ValueError:
          raise NRRDError('Invalid NRRD magic line: %s' % line)
  
      return len(line)
docs: For NRRD files, the first four characters are always "NRRD", and
      remaining characters give information about the file format version
  
      >>> _validate_magic_line('NRRD0005')
      8
      >>> _validate_magic_line('NRRD0006')
      Traceback (most recent call last):
          ...
      NrrdError: NRRD file version too new for this library.
      >>> _validate_magic_line('NRRD')
      Traceback (most recent call last):
          ...
      NrrdError: Invalid NRRD magic line: NRRD