def write_bytes(self, data):
if not isinstance(data, six.binary_type):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' %<EOL>(six.binary_type.__name__, data.__class__.__name__))<EOL><DEDENT>with self.open(mode='<STR_LIT:wb>') as f:<EOL><INDENT>return f.write(data)<EOL><DEDENT>
Open the file in bytes mode, write to it, and close the file.