Map<String, Object> metadata = null;
if (output.size() == 3) {
PyDictionary meta = (PyDictionary) output.get(2);
if(meta != null && !meta.isEmpty()) {
metadata = new HashMap<String, Object>();
for (Object key : meta.keySet()) {
metadata.put((String) key, meta.get(key));
}
}
}