code: def write(self, location=None):
          
          # Take location and expand tilde.
          if location is not None:
              self.location = location
          assert self.location
  
          # Find I/O backend that handles this location.
          for io in self.editor.io_backends:
              if io.can_open_location(self.location):
                  break
          else:
              self.editor.show_message('Unknown location: %r' % location)
  
          # Write it.
          try:
              io.write(self.location, self.buffer.text + '\n', self.encoding)
              self.is_new = False
          except Exception as e:
              # E.g. "No such file or directory."
              self.editor.show_message('%s' % e)
          else:
              # When the save succeeds: update: _file_content.
              self._file_content = self.buffer.text
docs: Write file to I/O backend.