<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_for_refresh(self, check_id):
 """ Given a Trusted Advisor check_id that has just been refreshed, poll until the refresh is complete. Once complete, return the check result. :param check_id: the Trusted Advisor check ID :type check_id: str :returns: dict check result. The return value of :py:meth:`Support.Client.describe_trusted_advisor_check_result` :rtype: dict """

        logger.warning('Polling for TA check %s refresh...', check_id)
        if self.refresh_timeout is None:
            # no timeout...
            cutoff = datetime_now() + timedelta(days=365)
        else:
            cutoff = datetime_now() + timedelta(seconds=self.refresh_timeout)
        last_status = None
        while datetime_now() <= cutoff:
            logger.debug('Checking refresh status')
            status = self.conn.describe_trusted_advisor_check_refresh_statuses(
                checkIds=[check_id]
            )['statuses'][0]['status']
            if status in ['success', 'abandoned']:
                logger.info('Refresh status: %s; done polling', status)
                break
            if status == 'none' and last_status not in ['none', None]:
                logger.warning('Trusted Advisor check refresh status went '
                               'from "%s" to "%s"; refresh is either complete '
                               'or timed out on AWS side. Continuing',
                               last_status, status)
                break
            last_status = status
            logger.info('Refresh status: %s; sleeping 30s', status)
            sleep(30)
        else:
            logger.error('Timed out waiting for TA Check refresh; status=%s',
                         status)
        logger.info('Done polling for check refresh')
        result, last_dt = self._get_check_result(check_id)
        logger.debug('Check shows last refresh time of: %s', last_dt)
        return result