'Write data to file.
Args:
data: Data to be written to the file. For RAW files it should be a string
or byte sequence.
sequence_key: Sequence key to use for write. Is used for RAW files only.
File API infrastructure ensures that sequence_key are monotonically
increasing. If sequence key less than previous one is used, a
SequenceKeyOutOfOrderError exception with last recorded sequence key
will be raised. If part of already written content is lost due to
infrastructure failure, last_sequence_key will point to last
successfully written key.
Raises:
SequenceKeyOutOfOrderError: Raised when passed sequence keys are not
monotonically increasing.
InvalidArgumentError: Raised when wrong object type is apssed in as data.
Error: Error or its descendants are raised when other error has happened.'

def write(self, data, sequence_key=None):

    if (self._content_type == RAW):
        request = file_service_pb.AppendRequest()
        response = file_service_pb.AppendResponse()
        request.set_filename(self._filename)
        request.set_data(data)
        if sequence_key:
            request.set_sequence_key(sequence_key)
        self._make_rpc_call_with_retry('Append', request, response)
    else:
        raise UnsupportedContentTypeError(('Unsupported    content    type:    %s' % self._content_type))
