Retrieve set of inputs and outputs connecting steps.

def _get_step_inout(step):
    """Retrieve set of inputs and outputs connecting steps.
    """
    inputs = []
    outputs = []
    prescatter = collections.defaultdict(list)
    remapped = {}
    assert step.outputs_record_schema["type"] == "record"
    output_names = set([])
    for outp in step.outputs_record_schema["fields"]:
        outputs.append({"id": outp["name"]})
        output_names.add(outp["name"])
    assert step.inputs_record_schema["type"] == "record"
    for inp in step.inputs_record_schema["fields"]:
        source = inp["source"].split("#")[-1].replace("/", ".")
        # Check if we're unpacking from a record, and unpack from our object
        if "valueFrom" in inp:
            attr_access = "['%s']" % inp["name"]
            if inp["valueFrom"].find(attr_access) > 0:
                source += ".%s" % inp["name"]
                if isinstance(inp["type"], dict) and isinstance(inp["type"].get("items"), dict):
                    if inp["type"]["items"].get("type") == "array" and "inputBinding" in inp["type"]:
                        source, prescatter = _unpack_object_array(inp, source, prescatter)
        # Avoid clashing input and output names, WDL requires unique
        if inp["name"] in output_names:
            new_name = inp["name"] + "_input"
            remapped[inp["name"]] = new_name
            inp["name"] = new_name
        inputs.append({"id": inp["name"], "value": source})
    return inputs, outputs, remapped, dict(prescatter)