def get_state_table(active_states):
	faulted = []
	stopped = []
	running = []
	style_class = {}
	state_lookup = {1:"Faulted", 2:"Stopped", 3:"Running"}
	for i in active_states:
		source_id = i
		time_stamp = active_states[i].get("timestamp","Unknown")
		time_stamp_converted = alarms.alarm_tables.get_timestamp(time_stamp)
		state = active_states[i].get("state","Unknown") 
		if time_stamp !=("Unknown"):
			duration = alarms.alarm_tables.convert(int(time_stamp))
		else:
			duration = 0
		state_list = []
		if state == 3:
			state_list = running
			style_class = {"classes":"State-Styles/State5"}
			state = state_lookup.get(state, 6)
		elif state == 2:
			state_list = stopped
			style_class = {"classes":"State-Styles/State2"}
			state = state_lookup.get(state, 6)
		elif state == 1:
			state_list = faulted
			style_class = {"classes":"State-Styles/State1"}
			state = state_lookup.get(state, 6)
		else:
			pass
		
		state_row =  row_builder.build_row_with_view(SourceId = source_id,
											TimeStamp = time_stamp_converted,
											Duration = duration,
											State = state,
											StyleClass = style_class )
		state_list.append(state_row)
		
	return faulted + stopped + running
		
		
		
		 	
	
