<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_ds9region(self, region, *args, **kwargs):
 """Create a ds9 compatible region file from the ROI. It calls the `to_ds9` method and write the result to the region file. Only the file name is required. All other parameters will be forwarded to the `to_ds9` method, see the documentation of that method for all accepted parameters and options. Parameters region : str name of the region file (string) """

        lines = self.to_ds9(*args,**kwargs)
        with open(region,'w') as fo:
            fo.write("\n".join(lines))