<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def poll_stack(self):
 """ Spin in a loop while the Cloud Formation process either fails or succeeds Args: None Returns: Good or bad; True or False """

        logging.info('polling stack status, POLL_INTERVAL={}'.format(POLL_INTERVAL))
        time.sleep(POLL_INTERVAL)
        completed_states = [
            'CREATE_COMPLETE',
            'UPDATE_COMPLETE',
            'DELETE_COMPLETE'
        ]
        stack_name = self._config.get('environment', {}).get('stack_name', None)
        while True:
            try:
                response = self._cloudFormation.describe_stacks(StackName=stack_name)
                stack = response['Stacks'][0]
                current_status = stack['StackStatus']
                logging.info('current status of {}: {}'.format(stack_name, current_status))
                if current_status.endswith('COMPLETE') or current_status.endswith('FAILED'):
                    if current_status in completed_states:
                        return True
                    else:
                        return False

                time.sleep(POLL_INTERVAL)
            except ClientError as wtf:
                if str(wtf).find('does not exist') == -1:
                    logging.error('Exception caught in wait_for_stack(): {}'.format(wtf))
                    traceback.print_exc(file=sys.stdout)
                    return False
                else:
                    logging.info('{} is gone'.format(stack_name))
                    return True
            except Exception as wtf:
                logging.error('Exception caught in wait_for_stack(): {}'.format(wtf))
                traceback.print_exc(file=sys.stdout)
                return False