<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_inputs_for_state(self, state):
 """Retrieves all input data of a state. If several data flows are connected to an input port the most current data is used for the specific input port. :param state: the state of which the input data is determined :return: the input data of the target state """

        result_dict = {}

        tmp_dict = self.get_default_input_values_for_state(state)
        result_dict.update(tmp_dict)

        for input_port_key, value in state.input_data_ports.items():
            # for all input keys fetch the correct data_flow connection and read data into the result_dict
            actual_value = None
            actual_value_time = 0
            for data_flow_key, data_flow in self.data_flows.items():

                if data_flow.to_key == input_port_key:
                    if data_flow.to_state == state.state_id:
                        # fetch data from the scoped_data list: the key is the data_port_key + the state_id
                        key = str(data_flow.from_key) + data_flow.from_state
                        if key in self.scoped_data:
                            if actual_value is None or actual_value_time < self.scoped_data[key].timestamp:
                                actual_value = deepcopy(self.scoped_data[key].value)
                                actual_value_time = self.scoped_data[key].timestamp

            if actual_value is not None:
                result_dict[value.name] = actual_value

        return result_dict