def _posargs_to_provides(posargspec, posargs):
    """Automatically unwrap injectable posargs into a more intuitive
    format, similar to an API a human might design. For instance, a
    function which takes exactly one argument would not take a list of
    exactly one argument.

    Cases as follows:

    1. min_count > 1 or max_count > 1, pass through posargs as a list
    2. max_count == 1 -> single argument or None

    Even if min_count == 1, you can get a None back. This compromise
    was made necessary to keep "to_cmd_scope" robust enough to pass to
    help/error handler funcs when validation fails.
    """
    pas = posargspec
    if pas.max_count is None or pas.min_count > 1 or pas.max_count > 1:
        return posargs
    if pas.max_count == 1:
        return posargs[0] if posargs else None
    raise RuntimeError('invalid posargspec/posargs configuration %r -- %r' %
        (posargspec, posargs))
