Single state, or multiple concurrent states ai

def multi_delete(list_, *args):
    indexes = sorted(list(args), reverse=True)
    for index in indexes:
        del list_[index]
    return list_


#in defines
def functionState1(args, index):
    #do something
    #exit condition
    #if exiting and inside tuple actstrip.pop(0)
    #else pop just the entry in the list at index
    if exitCondition == true:
        if type(own['actStrip'][0]) is tuple:
            own['actStrip'].pop(0)
           
        else:  
            return index
            

def functionState2(args,index):
    #do something different
    #exit condition
    if exitCondition:
        if type(own['actStrip'][0]) is tuple:
            own['actStrip'].pop(0)
          
        else: 
           return index;

StateDict = {}
StateDict['functionState1'] = functionState1
StateDict['functionState2'] = functionState2



#in main
if 'actStrip' in own:
     
    #you have a state to call
    if len(own['actStrip'])>0:
        #do 1 single thing and move on when it's done
        if type(own['actStrip']) is tuple:
            function =  stateDict[own['actStrip'][0][0]]
            function(own['actStrip'][0][1], -1)
        #do multiple things and move on when all done
        if type(own['actStrip'][0]) is list:
            popList = []
            index =0 
            if len(own['actStrip'][0])>0:
                for entry in own['actStrip'][0]:
                   function =  stateDict[entry[0][0]]
                   a = function(entry[0][1],index )
                   if a!=None:
                        #if there is return it's a index to pop
                        popList.append(a)
                   index+=1
            else:
                own['ActStrip'].pop(0)
            if len(popList)>0:
                multi_delete(own['ActStrip'][0], popList)
   else:
        del own['actStrip']
else:
    #proccessInput
    #checkForMotion(animate if need be)