parameters: (self, campaign_item=None, update=True)
return_statement: return {'success': False, 'message': 'Campaign is invalid'}
docstring: Add a campaign to this top-level object.
  
          :param campaign_item: The campaign to add.
          :type campaign_item: :class:`crits.core.crits_mongoengine.EmbeddedCampaign`
          :param update: If True, allow merge with pre-existing campaigns
          :              If False, do not change any pre-existing campaigns
          :type update:  boolean
          :returns: dict with keys "success" (boolean) and "message" (str)
docstring_summary: Add a campaign to this top-level object.
docstring_tokens: Add a campaign to this top - level object .
function: def add_campaign(self, campaign_item=None, update=True):
          """
          Add a campaign to this top-level object.
  
          :param campaign_item: The campaign to add.
          :type campaign_item: :class:`crits.core.crits_mongoengine.EmbeddedCampaign`
          :param update: If True, allow merge with pre-existing campaigns
          :              If False, do not change any pre-existing campaigns
          :type update:  boolean
          :returns: dict with keys "success" (boolean) and "message" (str)
          """
  
          if isinstance(campaign_item, EmbeddedCampaign):
              if campaign_item.name != None and campaign_item.name.strip() != '':
                  campaign_item.confidence = campaign_item.confidence.strip().lower()
                  if campaign_item.confidence == '':
                      campaign_item.confidence = 'low'
                  for c, campaign in enumerate(self.campaign):
                      if campaign.name == campaign_item.name:
                          if not update:
                              return {'success': False, 'message': 'This Campaign is already assigned.'}
                          con = {'low': 1, 'medium': 2, 'high': 3}
                          if con.get(campaign.confidence, 0) < con.get(campaign_item.confidence):
                              self.campaign[c].confidence = campaign_item.confidence
                              self.campaign[c].analyst = campaign_item.analyst
                          break
                  else:
                      self.campaign.append(campaign_item)
                  return {'success': True, 'message': 'Campaign assigned successfully!'}
          return {'success': False, 'message': 'Campaign is invalid'}
function_tokens: def add_campaign ( self , campaign_item = None , update = True ) : if isinstance ( campaign_item , EmbeddedCampaign ) : if campaign_item . name != None and campaign_item . name . strip ( ) != '' : campaign_item . confidence = campaign_item . confidence . strip ( ) . lower ( ) if campaign_item . confidence == '' : campaign_item . confidence = 'low' for c , campaign in enumerate ( self . campaign ) : if campaign . name == campaign_item . name : if not update : return { 'success' : False , 'message' : 'This Campaign is already assigned.' } con = { 'low' : 1 , 'medium' : 2 , 'high' : 3 } if con . get ( campaign . confidence , 0 ) < con . get ( campaign_item . confidence ) : self . campaign [ c ] . confidence = campaign_item . confidence self . campaign [ c ] . analyst = campaign_item . analyst break else : self . campaign . append ( campaign_item ) return { 'success' : True , 'message' : 'Campaign assigned successfully!' } return { 'success' : False , 'message' : 'Campaign is invalid' }