Helper function to facilitate upsert.

    Args:
        ini_date - the dictionary of info to run upsert

   Exit:
       0 - good
       1 - bad

def start_upsert(ini_data):
    """
    Helper function to facilitate upsert.

    Args:
        ini_date - the dictionary of info to run upsert

   Exit:
       0 - good
       1 - bad
    """
    stack_driver = CloudStackUtility(ini_data)
    poll_stack = not ini_data.get('no_poll', False)
    if stack_driver.upsert():
        logging.info('stack create/update was started successfully.')

        if poll_stack:
            stack_tool = None
            try:
                profile = ini_data.get('environment', {}).get('profile')
                if profile:
                    boto3_session = boto3.session.Session(profile_name=profile)
                else:
                    boto3_session = boto3.session.Session()

                region = ini_data['environment']['region']
                stack_name = ini_data['environment']['stack_name']

                cf_client = stack_driver.get_cloud_formation_client()

                if not cf_client:
                    cf_client = boto3_session.client('cloudformation', region_name=region)

                stack_tool = stack_tool = StackTool(
                    stack_name,
                    region,
                    cf_client
                )
            except Exception as wtf:
                logging.warning('there was a problems creating stack tool: {}'.format(wtf))

            if stack_driver.poll_stack():
                try:
                    logging.info('stack create/update was finished successfully.')
                    stack_tool.print_stack_info()
                except Exception as wtf:
                    logging.warning('there was a problems printing stack info: {}'.format(wtf))

                sys.exit(0)
            else:
                try:
                    logging.error('stack create/update was did not go well.')
                    stack_tool.print_stack_events()
                except Exception as wtf:
                    logging.warning('there was a problems printing stack events: {}'.format(wtf))
                sys.exit(1)
    else:
        logging.error('start of stack create/update did not go well.')
        sys.exit(1)