solving encoding problem when writing content to file.

Error: can't write unicode to binary stream. 

=== Exception traceback ===
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmv_cmd.py", line 760, in run
    self._sync(args, credential)
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmv_cmd.py", line 724, in _sync
    emails_only = args['emails_only'], chats_only = args['chats_only'])
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmvault.py", line 604, in sync
    self._sync_emails(imap_req, compress = compress_on_disk, restart = restart)
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmvault.py", line 567, in _sync_emails
    imap_ids = self._common_sync(timer, "email", imap_req, compress, restart)
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmvault.py", line 525, in _common_sync
    handle_sync_imap_error(error, the_id, self.error_report, self.src) #do everything in this handler
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmvault.py", line 156, in handle_sync_imap_error
    raise the_exception
TypeError: can't write unicode to binary stream

=== End of Exception traceback ===