def add(self, filename, stream, content_type=None):
<EOL>content_type = content_type or mimetypes.guess_type(filename)[<NUM_LIT:0>] or '<STR_LIT>'<EOL>response = self._record._swimlane.request(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>files={<EOL>'<STR_LIT:file>': (filename, stream, content_type)<EOL>},<EOL>)<EOL>raw_attachment_data = response.json()[<NUM_LIT:0>]<EOL>attachment = Attachment(self._record._swimlane, raw_attachment_data)<EOL>self._elements.append(attachment)<EOL>self._sync_field()<EOL>return attachment<EOL>
Upload a new attachment, and add it to current fields raw data to be persisted on save

        Can optionally manually set the content_type, will be guessed by provided filename extension and default to 
        application/octet-stream if it cannot be guessed