<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def hit_expire(self, all_hits, hit_ids=None):
        ''' Expire all HITs. '''
        if all_hits:
            hits_data = self.get_active_hits()
            hit_ids = [hit.options['hitid'] for hit in hits_data]
        for hit in hit_ids:
            success = self.amt_services.expire_hit(hit)
            if success:
                if self.sandbox:
                    print "expiring sandbox HIT", hit
                else:
                    print "expiring live HIT", hit