code: def chain_specs(specs):
      
      LOG.info("Parsing %s specs", len(specs))
      # First spec is always an input
      pin = pypein.input_for(specs[0]).__iter__()
      # If only an input spec was provided, then use json for output
      if len(specs) == 1:
          pout = pypeout.output_for("json")
      else:
          # Middle specs are filters that successively wrap input
          for s in specs[1:-1]:
              pin = pypef.filter_for(s).filter(pin)
          # Assume output on last spec, but it may be a filter.
          # If last spec is a filter, use json for output
          try:
              pout = pypeout.output_for(specs[-1])
          except pypeout.NoSuchOutputException:
              pin = pypef.filter_for(specs[-1]).filter(pin)
              pout = pypeout.output_for("json")
      return pout, pin
docs: Parses the incoming list of specs and produces a tuple (pout, pin) that can be invoked with:
          <pre>
          result = pout.process(pin)
          </pre>