def write_file(self, check=True):
        """
        Write the package file.

        Parameters
        ----------
        check : boolean
            Check package data for common errors. (default True)

        Returns
        -------
        None

        """
        if check: # allows turning off package checks when writing files at model level
            self.check(f='{}.chk'.format(self.name[0]), verbose=self.parent.verbose, level=1)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        # Open file for writing
        f = open(self.fn_path, 'w')
        # Item 0: text
        f.write('%s\n' % self.heading)
        # Item 1: IBCFCB, HDRY, NPLPF        
        f.write('{0:10d}{1:10.6G}{2:10d} {3:s}\n'.format(self.ipakcb,
                                                             self.hdry,
                                                             self.nplpf,
                                                             self.options))
        # LAYTYP array
        f.write(self.laytyp.string)
        # LAYAVG array
        f.write(self.layavg.string)
        # CHANI array
        f.write(self.chani.string)
        # LAYVKA array
        f.write(self.layvka.string)
        # LAYWET array
        f.write(self.laywet.string)
        # Item 7: WETFCT, IWETIT, IHDWET
        iwetdry = self.laywet.sum()
        if 0 > iwetdry:
            f.write('{0:10f}{1:10d}{2:10d}\n'.format(self.wetfct,
                                                         self.iwetit,
                                                         self.ihdwet))
        transient = not self.parent.get_package('DIS').steady.all()
        for k in range(nlay):
            f.write(self.hk[k].get_file_entry())
            if self.chani[k] < 1:
                f.write(self.hani[k].get_file_entry())
            f.write(self.vka[k].get_file_entry())
            if transient == True:
                f.write(self.ss[k].get_file_entry())
                if self.laytyp[k] != 0:
                    f.write(self.sy[k].get_file_entry())
            if self.parent.get_package('DIS').laycbd[k] > 0:
                f.write(self.vkcb[k].get_file_entry())
            if (self.laywet[k] != 0 and self.laytyp[k] != 0):
                f.write(self.wetdry[k].get_file_entry())
        f.close()
        return

        '''
        def check(self, f=None, verbose=True, level=1):
        """
        Check lpf package data for common errors.

        Parameters
        ----------
        f : str or file handle
            String defining file name or file handle for summary file
            of check method output. If a sting is passed a file handle
            is created. If f is None, check method does not write
            results to a summary file. (default is None)
        verbose : bool
            Boolean flag used to determine if check method results are
            written to the screen
        level : int
            Check method analysis level. If level=0, summary checks are
            performed. If level=1, full checks are performed.

        Returns
        -------
        None

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow.load('model.nam')
        >>> m.lpf.check()
        """
        if f is not None:
            if isinstance(f, str):
                pth = os.path.join(self.parent.model_ws, f)
                f = open(pth, 'w', 0)

        errors = False
        txt = '\n{} PACKAGE DATA VALIDATION:\n'.format(self.name[0])
        t = ''
        t1 = ''
        inactive = self.parent.bas6.ibound.array == 0
        # hk errors
        d = self.hk.array
        d[inactive] = 0.
        if d.min() < 0:
            errors = True
            t = '{}  ERROR: Negative horizontal hydraulic conductivity specified.\n'.format(t)
            if level > 0:
                idx = np.column_stack(np.where(d < 0.))
                t1 = self.level1_arraylist(idx, d, self.hk.name, t1)
        else:
            t = '{}  Specified horizontal hydraulic conductivity is OK.\n'.format(t)
        # hani errors
        d = self.hani.array
        name = self.hk.name
        d[inactive] = 0.
        # exclude layers without horizontal anisotropy
        use_array = False
        for k in range(d.shape[0]):
            if self.chani[k] > 0:
                d[k, :, :] = 1
            else:
                use_array = True
        if d.min() < 0:
            errors = True
            t = '{}  ERROR: Negative horizontal hydraulic conductivity ratio specified.\n'.format(t)
            if level > 0:
                idx = np.column_stack(np.where(d < 0.))
                t1 = self.level1_arraylist(idx, d, self.hani.name, t1)
        else:
            if use_array:
                t = '{}  Specified horizontal hydraulic conductivity ratio is OK.\n'.format(t)
        # vka errors
        d = self.vka.array
        d[inactive] = 1.
        if d.min() <= 0:
            errors = True
            t = '{}  ERROR: Negative or zero vertical hydraulic conductivity specified.\n'.format(t)
            if level > 0:
                idx = np.column_stack(np.where(d <= 0.))
                t1 = self.level1_arraylist(idx, d, self.vka.name, t1)
        else:
            t = '{}  Specified vertical hydraulic conductivity is OK.\n'.format(t)
        # vkcb errors
        d = self.vkcb.array
        d[inactive] = 1.
        # exclude layers without vertical confining beds
        use_array = False
        for k in range(d.shape[0]):
            if self.parent.get_package('DIS').laycbd[k] == 0:
                d[k, :, :] = 1
            else:
                use_array = True
        if d.min() < 0:
            errors = True
            t = '{}  ERROR: Negative or zero quasi-3D confining bed vertical ' +\
                'hydraulic conductivity specified.\n'.format(t)
            if level > 0:
                idx = np.column_stack(np.where(d <= 0.))
                t1 = self.level1_arraylist(idx, d, self.vkcb.name, t1)
        else:
            if use_array:
                t = '{}  Specified quasi-3D confining bed vertical hydraulic conductivity is OK.\n'.format(t)
        # storage errors
        transient = not self.parent.get_package('DIS').steady.all()
        if transient:
            # Ss errors
            d = self.ss.array
            d[inactive] = 1.
            if d.min() < 0:
                errors = True
                t = '{}  ERROR: Negative specific storage specified.\n'.format(t)
                if level > 0:
                    idx = np.column_stack(np.where(d < 0.))
                    t1 = self.level1_arraylist(idx, d, self.ss.name, t1)
            else:
                t = '{}  Specified specific storage is OK.\n'.format(t)
            # Sy errors
            d = self.sy.array
            d[inactive] = 1.
            # exclude non-convertible layers from error checking
            use_array = False
            for k in range(d.shape[0]):
                if self.laytyp[k] == 0:
                    d[k, :, :] = 1
                else:
                    use_array = True
            if d.min() < 0:
                errors = True
                t = '{}  ERROR: Negative specific yield specified.\n'.format(t)
                if level > 0:
                    idx = np.column_stack(np.where(d < 0.))
                    t1 = self.level1_arraylist(idx, d, self.sy.name, t1)
            else:
                if use_array:
                    t = '{}  Specified specific yield is OK.\n'.format(t)

        # add header to level 0 text
        txt += t

        if level > 0:
            if errors:
                txt += '\n  DETAILED SUMMARY OF {} ERRORS:\n'.format(self.name[0])
                # add level 1 header to level 1 text
                txt += t1

        # write errors to summary file
        if f is not None:
            f.write('{}\n'.format(txt))

        # write errors to stdout
        if verbose:
            print(txt)
        '''
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mflpf.py/ModflowLpf.write_file/swapped operands of `>`