code: def write_ds9region(self, region, *args, **kwargs):
  
          
          lines = self.to_ds9(*args,**kwargs)
          with open(region,'w') as fo:
              fo.write("\n".join(lines))
docs: 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)