<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_campaign(self, campaign_object=None, campaign_id=None, **kwargs):
 """Update an update campaign. :param :class:`Campaign` campaign_object: Campaign object to update (Required) :return: updated campaign object :rtype: Campaign """

        api = self._get_api(update_service.DefaultApi)
        if campaign_object:
            campaign_id = campaign_object.id
            campaign_object = campaign_object._create_patch_request()
        else:
            campaign_object = Campaign._create_request_map(kwargs)
        if 'device_filter' in campaign_object:
            campaign_object["device_filter"] = filters.legacy_filter_formatter(
                dict(filter=campaign_object["device_filter"]),
                Device._get_attributes_map()
            )['filter']
        if 'when' in campaign_object:
            # FIXME: randomly validating an input here is a sure route to nasty surprises elsewhere
            campaign_object['when'] = force_utc(campaign_object['when'])
        return Campaign(api.update_campaign_update(campaign_id=campaign_id,
                                                   campaign=campaign_object))