<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_event(self, source, reference, event_title, event_type, method='', description='', bucket_list=[], campaign='', confidence='', date=None):
 """ Adds an event. If the event name already exists, it will return that event instead. Args: source: Source of the information reference: A reference where more information can be found event_title: The title of the event event_type: The type of event. See your CRITs vocabulary. method: The method for obtaining the event. description: A text description of the event. bucket_list: A list of bucket list items to add campaign: An associated campaign confidence: The campaign confidence date: A datetime.datetime object of when the event occurred. Returns: A JSON event object or None if there was an error. """

        # Check to see if the event already exists
        events = self.get_events(event_title)
        if events is not None:
            if events['meta']['total_count'] == 1:
                return events['objects'][0]
            if events['meta']['total_count'] > 1:
                log.error('Multiple events found while trying to add the event'
                          ': {}'.format(event_title))
                return None
        # Now we can create the event
        data = {
            'api_key': self.api_key,
            'username': self.username,
            'source': source,
            'reference': reference,
            'method': method,
            'campaign': campaign,
            'confidence': confidence,
            'description': description,
            'event_type': event_type,
            'date': date,
            'title': event_title,
            'bucket_list': ','.join(bucket_list),
        }

        r = requests.post('{}/events/'.format(self.url), data=data,
                          verify=self.verify, proxies=self.proxies)
        if r.status_code == 200:
            log.debug('Event created: {}'.format(event_title))
            json_obj = json.loads(r.text)
            if 'id' not in json_obj:
                log.error('Error adding event. id not returned.')
                return None
            return json_obj
        else:
            log.error('Event creation failed with status code: '
                      '{}'.format(r.status_code))
            return None