<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_io_data_port_id_from_name_and_type(self, name, data_port_type):
 """Returns the data_port_id of a data_port with a certain name and data port type :param name: the name of the target data_port :param data_port_type: the data port type of the target data port :return: the data port specified by the name and the type :raises exceptions.AttributeError: if the specified data port does not exist in the input or output data ports """

        if data_port_type is InputDataPort:
            for ip_id, output_port in self.input_data_ports.items():
                if output_port.name == name:
                    return ip_id
            raise AttributeError("Name '{0}' is not in input_data_ports".format(name))
        elif data_port_type is OutputDataPort:
            for op_id, output_port in self.output_data_ports.items():
                if output_port.name == name:
                    return op_id
            # 'error' is an automatically generated output port in case of errors and exception and doesn't have an id
            if name == "error":
                return
            raise AttributeError("Name '{0}' is not in output_data_ports".format(name))