<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _process_attachments(self, attachments):
 """ 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". """

        for a in attachments:
            if not isinstance(a, dict):
                if isinstance(a, string_types):
                    a = open(a, 'rb')
                filename = basename(getattr(a, 'name', 'untitled'))
                a = {
                    "filename": filename,
                    "content_type": guess_type(filename)[0] or 'application/octet-stream',
                    "content": a.read(),
                }
            if isinstance(a['content'], binary_type):
                a['content'] = b64encode(a['content']).decode()
                a['encoded'] = True
            yield a