def subscribe_with_data(mailchimp, list_id, user_data):
 format_entry = (lambda e: {name_to_tag(k): v for (k, v) in e.iteritems()})
 formated_data = list((format_entry(e) for e in user_data))
 for batch in chunk(formated_data, SUBSCRIBE_BATCH_SIZE):
  result = mailchimp.listBatchSubscribe(id=list_id, batch=batch, double_optin=False, update_existing=True)
  log.debug('Added: %s Error on: %s', result['add_count'], result['error_count'])

def subscribe_with_data ( mailchimp , list_id , user_data ) : format_entry = ( lambda e : { name_to_tag ( k ) : v for ( k , v ) in e . iteritems ( ) } ) formated_data = list ( ( format_entry ( e ) for e in user_data ) ) for batch in chunk ( formated_data , SUBSCRIBE_BATCH_SIZE ) : result = mailchimp . listBatchSubscribe ( id = list_id , batch = batch , double_optin = False , update_existing = True ) log . debug ( 'Added: %s Error on: %s' , result [ 'add_count' ] , result [ 'error_count' ] )
given user_data in the form of a list of dictionaries for each user .