<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, filename=None, io=None, coors=None, igs=None, out=None, float_format=None, **kwargs):
 """ Write mesh + optional results in `out` to a file. Parameters filename : str, optional The file name. If None, the mesh name is used instead. io : MeshIO instance or 'auto', optional Passing 'auto' respects the extension of `filename`. coors : array, optional The coordinates that can be used instead of the mesh coordinates. igs : array_like, optional Passing a list of group ids selects only those groups for writing. out : dict, optional The output data attached to the mesh vertices and/or cells. float_format : str, optional The format string used to print floats in case of a text file format. **kwargs : dict, optional Additional arguments that can be passed to the `MeshIO` instance. """

        if filename is None:
            filename = self.name + '.mesh'

        if io is None:
            io = self.io
            if io is None:
                io = 'auto'

        if io == 'auto':
            io = MeshIO.any_from_filename( filename )

        if coors is None:
            coors = self.coors

        if igs is None:
            igs = range( len( self.conns ) )

        aux_mesh = Mesh.from_data( self.name, coors, self.ngroups,
                                   self.conns, self.mat_ids, self.descs, igs )
        io.set_float_format( float_format )
        io.write( filename, aux_mesh, out, **kwargs )