'Execute the command'

def handle(self, *args, **options):

    with open(options['file_name']) as orders_file:
        order_ids = [int(line.strip()) for line in orders_file.readlines()]
    orders = Order.objects.filter(id__in=order_ids)
    for order in orders:
        old_status = order.status
        try:
            order.retire()
        except (UnexpectedOrderItemStatus, InvalidStatusToRetire) as err:
            print 'Did    not    retire    order    {order}:    {message}'.format(order=order.id, message=err.message)
        else:
            print 'retired    order    {order_id}    from    status    {old_status}    to    status    {new_status}'.format(order_id=order.id, old_status=old_status, new_status=order.status)
