code: def _read_file(filename):
      
      # read data
      with open(filename, 'r') as fid2:
          abem_data_orig = fid2.read()
  
      fid = StringIO()
      fid.write(abem_data_orig)
      fid.seek(0)
  
      # determine type of array
      fid.readline()
      fid.readline()
      file_type = int(fid.readline().strip())
  
      # reset file pointer
      fid.seek(0)
      return file_type, fid
docs: Read a res2dinv-file and return the header
  
      Parameters
      ----------
      filename : string
          Data filename
  
      Returns
      ------
      type : int
          type of array extracted from header
      file_data : :py:class:`StringIO.StringIO`
          content of file in a StringIO object