def decode_port(self, port_info, simple_t, compound_t, deprecated_t,
                    is_input):
        if (not isinstance(port_info, simple_t) and
                not isinstance(port_info, compound_t)):
            port_name = port_info[0]
            port_sig = port_info[1]
            if len(port_info) > 2:
                if isinstance(port_info[2], dict):
                    port_info = compound_t(port_info[0],
                                                port_info[1],
                                                **port_info[2])

                else:
                    dep_port_info = deprecated_t(*port_info)
                    port_info = \
                        compound_t(**dep_port_info._asdict())
            else:
                port_info = compound_t(*port_info)

        # convert simple ports to compound ones
        kwargs = port_info._asdict()
        port_name = kwargs.pop('name')
        port_sig = kwargs.pop('signature')
        if is_input and isinstance(port_info, simple_t):
            kwargs['labels'] = [kwargs.pop('label')]
            kwargs['defaults'] = [kwargs.pop('default')]
            kwargs['values'] = [kwargs.pop('values')]
            kwargs['entry_types'] = [kwargs.pop('entry_type')]
        elif isinstance(port_info, compound_t):
            # have compound port
            port_items = kwargs.pop('items')
            if port_items is not None:
                sig_items = []
                labels = []
                defaults = []
                values = []
                entry_types = []
                for item in port_info.items:
                    if not isinstance(item.signature,
                                      basestring):
                        d = self.get_descriptor(item.signature)
                        sig_items.append(create_port_spec_item_string(
                            d.package, d.name, d.namespace))
                    else:
                        sig_items.append(item.signature)
                    labels.append(item.label)
                    defaults.append(item.default)
                    values.append(item.values)
                    entry_types.append(item.entry_type)
                kwargs['signature'] = ','.join(sig_items)
                if is_input:
                    kwargs['labels'] = labels
                    kwargs['defaults'] = defaults
                    kwargs['values'] = values
                    kwargs['entry_types'] = entry_types

        return port_name, port_sig, kwargs
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/module_registry.py/ModuleRegistry.decode_port/original