original_docstring: Removes a user from the Basket subscription.
docstring: Removes a user from the Basket subscription.
docstring_tokens: Removes a user from the Basket subscription .
code: def unsubscribe_user_task(self, result, newsletters=[], optout=False):
      """Removes a user from the Basket subscription."""
  
      if not result:
          return None
  
      newsletters_to_unsubscribe = []
      if result.get('status') == 'ok':
          email = result.get('email')
          token = result.get('token')
  
          # only unsubscribe from our newsletters
          if newsletters:
              newsletters_to_unsubscribe = list(set(newsletters).intersection(result['newsletters']))
          else:
              newsletters_to_unsubscribe = list(set(MOZILLIANS_NEWSLETTERS)
                                                .intersection(result['newsletters']))
  
      # Unsubscribe the calculated newsletters
      if newsletters_to_unsubscribe:
          try:
              unsubscribe_result = basket.unsubscribe(token=token,
                                                      email=email,
                                                      newsletters=newsletters_to_unsubscribe,
                                                      optout=optout)
          except MaxRetriesExceededError as exc:
              raise exc
          except basket.BasketException as exc:
              raise self.retry(exc=exc)
          return unsubscribe_result
      return None
code_tokens: def unsubscribe_user_task ( self , result , newsletters = [ ] , optout = False ) : if not result : return None newsletters_to_unsubscribe = [ ] if result . get ( 'status' ) == 'ok' : email = result . get ( 'email' ) token = result . get ( 'token' ) if newsletters : newsletters_to_unsubscribe = list ( set ( newsletters ) . intersection ( result [ 'newsletters' ] ) ) else : newsletters_to_unsubscribe = list ( set ( MOZILLIANS_NEWSLETTERS ) . intersection ( result [ 'newsletters' ] ) ) if newsletters_to_unsubscribe : try : unsubscribe_result = basket . unsubscribe ( token = token , email = email , newsletters = newsletters_to_unsubscribe , optout = optout ) except MaxRetriesExceededError as exc : raise exc except basket . BasketException as exc : raise self . retry ( exc = exc ) return unsubscribe_result return None
short_docstring: Removes a user from the Basket subscription.
short_docstring_tokens: Removes a user from the Basket subscription .
comment: """Removes a user from the Basket subscription."""$SEP$# only unsubscribe from our newsletters$SEP$# Unsubscribe the calculated newsletters