def _javaMapToDict(m):
    """
    Converts a java map to a python dictionary.

    :param m: java map.
    :return: python dictionary.
    """

    result = {}

    for e in m.entrySet().toArray():
        k = e.getKey()
        v = e.getValue()
        result[k] = v

    return result