'For given workflow \'step\' that has had input_connections_by_name
populated fetch the actual runtime input for the given tool \'input\'.'

def replacement_for_tool_input(self, step, input, prefixed_name):

    replacement = modules.NO_REPLACEMENT
    if (prefixed_name in step.input_connections_by_name):
        connection = step.input_connections_by_name[prefixed_name]
        if ((input.type == 'data') and input.multiple):
            replacement = [self.replacement_for_connection(c) for c in connection]
            if (len(replacement) == 1):
                if isinstance(replacement[0], model.HistoryDatasetCollectionAssociation):
                    replacement = replacement[0]
        else:
            is_data = (input.type in ['data', 'data_collection'])
            replacement = self.replacement_for_connection(connection[0], is_data=is_data)
    return replacement
