<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def show_inputs(self, varnames=None, nids=None, wslice=None, stream=sys.stdout):
 """ Print the input of the tasks to the given stream. Args: varnames: List of Abinit variables. If not None, only the variable in varnames are selected and printed. nids: List of node identifiers. By defaults all nodes are shown wslice: Slice object used to select works. stream: File-like object, Default: sys.stdout """

        if varnames is not None:
            # Build dictionary varname --> [(task1, value), (task2, value), ...]
            varnames = [s.strip() for s in list_strings(varnames)]
            dlist = collections.defaultdict(list)
            for task in self.select_tasks(nids=nids, wslice=wslice):
                dstruct = task.input.structure.as_dict(fmt="abivars")

                for vname in varnames:
                    value = task.input.get(vname, None)
                    if value is None: # maybe in structure?
                        value = dstruct.get(vname, None)
                    if value is not None:
                        dlist[vname].append((task, value))

            for vname in varnames:
                tv_list = dlist[vname]
                if not tv_list:
                    stream.write("[%s]: Found 0 tasks with this variable\n" % vname)
                else:
                    stream.write("[%s]: Found %s tasks with this variable\n" % (vname, len(tv_list)))
                    for i, (task, value) in enumerate(tv_list):
                        stream.write("   %s --> %s\n" % (str(value), task))
                stream.write("\n")

        else:
            lines = []
            for task in self.select_tasks(nids=nids, wslice=wslice):
                s = task.make_input(with_header=True)

                # Add info on dependencies.
                if task.deps:
                    s += "\n\nDependencies:\n" + "\n".join(str(dep) for dep in task.deps)
                else:
                    s += "\n\nDependencies: None"

                lines.append(2*"\n" + 80 * "=" + "\n" + s + 2*"\n")

            stream.writelines(lines)