<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect_input(self, spec_name, node, node_input, format=None, **kwargs):
 # @ReservedAssignment @IgnorePep8 """ Connects a study fileset_spec as an input to the provided node Parameters spec_name : str Name of the study data spec (or one of the IDs from the iterator nodes, 'subject_id' or 'visit_id') to connect to the node node : arcana.Node The node to connect the input to node_input : str Name of the input on the node to connect the fileset spec to format : FileFormat | None The file format the input is expected in. If it differs from the format in data spec or of study input then an implicit conversion is performed. If None the file format in the data spec is assumed """

        if spec_name in self.study.ITERFIELDS:
            self._iterator_conns[spec_name].append((node, node_input, format))
        else:
            name = self._map_name(spec_name, self._input_map)
            if name not in self.study.data_spec_names():
                raise ArcanaDesignError(
                    "Proposed input '{}' to {} is not a valid spec name ('{}')"
                    .format(name, self._error_msg_loc,
                            "', '".join(self.study.data_spec_names())))
            self._input_conns[name].append((node, node_input, format, kwargs))