<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_post(self, req, resp, rid):
 """ Deserialize the file upload & save it to S3 File uploads are associated with a model of some kind. Ensure the associating model exists first & foremost. """


        signals.pre_req.send(self.model)
        signals.pre_req_upload.send(self.model)

        props = req.deserialize(self.mimetypes)
        model = find(self.model, rid)

        signals.pre_upload.send(self.model, model=model)

        try:
            conn = s3_connect(self.key, self.secret)
            path = self._gen_s3_path(model, props)
            s3_url = s3_upload(self.acl, self.bucket, conn, props['content'],
                               props['content-type'], path)
        except IOError:
            abort(ServiceUnavailable(**{
                'detail': 'The upload attempt failed unexpectedly',
            }))
        else:
            signals.post_upload.send(self.model, model=model, url=s3_url)

            resp.location = s3_url
            resp.status = falcon.HTTP_201

            resp.serialize({'data': {'url': s3_url}})

            signals.post_req.send(self.model)
            signals.post_req_upload.send(self.model)