<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def perform(self):
 """Runs through all of the steps in the chain and runs each of them in sequence. :return: The value from the lat "do" step performed """

        last_value = None
        last_step = None

        while self.items.qsize():

            item = self.items.get()

            if item.flag == self.do:
                last_value = item.item(*item.args, **item.kwargs)
                last_step = item.message
            elif item.flag == self.expect:
                message = item.message
                local = {'value': last_value, 'expectation': item.item}
                expression = 'value {operator} expectation'.format(operator=item.operator)
                result = eval(expression, local)

                # Format the error message
                format_vars = {
                    'actual': last_value,
                    'expected': item.item,
                    'step': last_step,
                    'operator': item.operator
                }

                for var, val in format_vars.iteritems():
                    message = message.replace('{' + str(var) + '}', str(val))

                assert result, message

        return last_value