def _process_attachments(self, attachments):
for a in attachments:<EOL><INDENT>if not isinstance(a, dict):<EOL><INDENT>if isinstance(a, string_types):<EOL><INDENT>a = open(a, '<STR_LIT:rb>')<EOL><DEDENT>filename = basename(getattr(a, '<STR_LIT:name>', '<STR_LIT>'))<EOL>a = {<EOL>"<STR_LIT:filename>": filename,<EOL>"<STR_LIT>": guess_type(filename)[<NUM_LIT:0>] or '<STR_LIT>',<EOL>"<STR_LIT:content>": a.read(),<EOL>}<EOL><DEDENT>if isinstance(a['<STR_LIT:content>'], binary_type):<EOL><INDENT>a['<STR_LIT:content>'] = b64encode(a['<STR_LIT:content>']).decode()<EOL>a['<STR_LIT>'] = True<EOL><DEDENT>yield a<EOL><DEDENT>
Create attachments suitable for delivery to Hectane from the provided
list of attachments.

Each attachment may be either a local filename, a file object, or a
dict describing the content (in the same format as Hectane). Note that
if the filename cannot be determined, it will be set to "untitled".