def open_writer(self, reopen=False, endpoint=None, **kwargs):
        """
        Open a volume partition to write to. You can use `open` method to open a file inside the volume and write to it,
        or use `write` method to write to specific files.

        :param bool reopen: whether we need to open an existing write session
        :param str endpoint: tunnel service URL
        :param compress_option: the compression algorithm, level and strategy
        :type compress_option: :class:`odps.tunnel.CompressOption`
        :Example:
        >>> with partition.open_writer() as writer:
        >>>     writer.open('file1').write('some content')
        >>>     writer.write('file2', 'some content')
        """
        tunnel = self._create_volume_tunnel(endpoint=endpoint)
        upload_id = self._upload_id if not reopen else None
        upload_session = tunnel.create_upload_session(volume=self.volume.name, partition_spec=self.name,
                                                      upload_id=upload_id, **kwargs)
        file_dict = dict()

        class FilesWriter(object):
            @property
            def status(self):
                return upload_session.status

            @staticmethod
            def open(file_name, **kwargs):
                if file_name in file_dict:
                    return file_dict[file_name]
                writer = upload_session.open(file_name, **kwargs)
                file_dict[file_name] = writer
                return writer

            @staticmethod
            def write(file_name, buf, **kwargs):
                writer = FilesWriter.open(file_name, **kwargs)
                writer.write(buf)

            @staticmethod
            def close():
                for w in six.itervalues(file_dict):
                    w.close()

                upload_session.commit(list(six.iterkeys(file_dict)))

            def __enter__(self):
                return self

            def __exit__(self, exc_type, exc_val, exc_tb):
                self.close()

        return FilesWriter()
Open a volume partition to write to. You can use `open` method to open a file inside the volume and write to it,
        or use `write` method to write to specific files.

        :param bool reopen: whether we need to open an existing write session
        :param str endpoint: tunnel service URL
        :param compress_option: the compression algorithm, level and strategy
        :type compress_option: :class:`odps.tunnel.CompressOption`
        :Example:
        >>> with partition.open_writer() as writer:
        >>>     writer.open('file1').write('some content')
        >>>     writer.write('file2', 'some content')