I am trying to execute the below java code.But when I try to assign the dictionary to map it gives an classcast exception as below

Exception in thread "main" java.lang.ClassCastException: org.python.core.PyDictionary cannot be cast to java.util.Map

# myfile.py
# method which returns a Dictionary
def getDictionary():
    Dictionary2 = {}
    Dictionary2['add'] = {'returns': 'int', 'operationName': 'add', 'var1': 'integer', 'var2': 'integer'}
    Dictionary2['deduct'] = {'returns': 'double', 'operationName': 'deduct', 'var1': 'integer', 'var2': 'integer'}
    Dictionary2['f'] = {'a': 'double', 'returns': 'double', 'operationName': 'f'}
    return Dictionary2

# test.java
# main method which calls the above method
public static void main(String args []) throws PyException {
        System.out.println("testing 123");
        PythonInterpreter interp =  new PythonInterpreter();
        interp.exec("import sys");
        interp.exec("print sys.path");

        String str3 = "/home/heshan/workspace/IdeaProjects/PYtest/src/essentialScripts/myfile.py";
        PyObject obj = interp.eval("getDictionary()");
        Map map = (Map) obj;

        Iterator k = map.keySet().iterator();
            while (k.hasNext()) {
              String key = (String) k.next();
              System.out.println("Key " + key + "; Value " +
                (String) map.get(key));