<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def form_invalid(self, form):
 """This is what's called when the form is invalid."""

        ip = get_user_ip(self.request)
        if settings.CONTACT_FORM_USE_SIGNALS:
            contact_form_invalid.send(
                sender=self,
                event=self.invalid_event,
                ip=ip,
                site=self.site,
                sender_name=form['sender_name'],
                sender_email=form['sender_email']
            )

        return super(ContactFormView, self).form_invalid(form)