import time


def timer_task(self, count):
    """Background task that runs a long function with progress reports."""
    count = int(count)
    for i in range(count):
        message = '{0} seconds left'.format(count - i)
        self.update_state(state='PROGRESS',
                          meta={'current': i*100./count,
                                'total': count * 100 / count,
                                'status': message})
        time.sleep(.5)
    return {'current': 100,
            'total': 100,
            'status': 'Task completed!'}