def _get_or_create_user_list(sailthru_client, list_name):
 sailthru_list_cache = cache.get(SAILTHRU_LIST_CACHE_KEY)
 is_cache_updated = False
 if (not sailthru_list_cache):
  sailthru_list_cache = _get_list_from_email_marketing_provider(sailthru_client)
  is_cache_updated = True
 sailthru_list = sailthru_list_cache.get(list_name)
 if (not sailthru_list):
  is_created = _create_user_list(sailthru_client, list_name)
  if is_created:
   sailthru_list_cache = _get_list_from_email_marketing_provider(sailthru_client)
   is_cache_updated = True
   sailthru_list = sailthru_list_cache.get(list_name)
 if is_cache_updated:
  cache.set(SAILTHRU_LIST_CACHE_KEY, sailthru_list_cache)
 return sailthru_list

def _get_or_create_user_list ( sailthru_client , list_name ) : sailthru_list_cache = cache . get ( SAILTHRU_LIST_CACHE_KEY ) is_cache_updated = False if ( not sailthru_list_cache ) : sailthru_list_cache = _get_list_from_email_marketing_provider ( sailthru_client ) is_cache_updated = True sailthru_list = sailthru_list_cache . get ( list_name ) if ( not sailthru_list ) : is_created = _create_user_list ( sailthru_client , list_name ) if is_created : sailthru_list_cache = _get_list_from_email_marketing_provider ( sailthru_client ) is_cache_updated = True sailthru_list = sailthru_list_cache . get ( list_name ) if is_cache_updated : cache . set ( SAILTHRU_LIST_CACHE_KEY , sailthru_list_cache ) return sailthru_list
get list from sailthru and return if list_name exists else create a new one and return list data for all lists .