def _format_iospecs(specs, **kwargs):
    """Expand substitutions in specification lists.

    The expansion is generally a format() call on each items, using
    the kwargs as substitution mapping. A special case is, however,
    a single-item specification list that exclusively contains a
    plain substitution reference, i.e., ``{subst}``, that matches
    a kwargs-key (minus the brace chars), whose value is a list.
    In this case the entire specification list is substituted for
    the list in kwargs, which is returned as such. This enables
    the replace/re-use sequences, e.g. --inputs '{outputs}'

    Parameters
    ----------
    specs: list(str) or None
      Specification items to format.
    **kwargs:
      Placeholder key-value mapping to apply to specification items.

    Returns
    -------
    list
      All formatted items.
    """
    if not specs:
        return
    elif len(specs) == 1 and specs[0] \
            and specs[0][0] == '{' and specs[0][-1] == '}' \
            and isinstance(kwargs.get(specs[0][1:-1]), list):
        return kwargs[specs[0][1:-1]]
    return [
        s.format(**kwargs) for s in specs
    ]