code: def read_array(fd, n_row, n_col, dtype):
      
      if n_col is None:
          idx = fd.tell()
          row = fd.readline().split()
          fd.seek(idx)
          n_col = len(row)
  
      count = n_row * n_col
      val = nm.fromfile(fd, sep=' ', count=count)
  
      if val.shape[0] < count:
          raise ValueError('(%d, %d) array reading failed!' % (n_row, n_col))
  
      val = nm.asarray(val, dtype=dtype)
      val.shape = (n_row, n_col)
  
      return val
docs: Read a NumPy array of shape `(n_row, n_col)` from the given file
      object and cast it to type `dtype`.
      If `n_col` is None, determine the number of columns automatically.