Map<String,Object> results = new LinkedHashMap<String, Object>();
for (Map.Entry<String, Parameter<?>> e : outputs.entrySet()) {
String key = e.getKey();
Parameter output = e.getValue();
Object obj = result.get(key);
if (obj instanceof PyObject) {
obj = ((PyObject) obj).__tojava__(output.type);
}
if (obj != null && !output.type.isInstance(obj)) {
LOGGER.warning(String.format("Output %s declared type %s but returned %s",
output.getName(), output.getType().getSimpleName(), obj.getClass().getSimpleName()));
}
results.put(output.key, obj);
}