call the method attachment.add_header with 3 arguments: string 'Content-Disposition', string 'attachment' and filename set to filename.
attachment . add_header ( 'Content-Disposition' , 'attachment' , filename = filename )