def find_py4j_error_root_cause(java_exception):
    """
    Walks up the chain of Java exceptions by repeatedly calling getCause().

    :param java_exception: An instance of java_exception (Exception) from py4j.protocol.Py4JJavaError
    :return: The most nested Java Exception accessible
    """

    if java_exception:
        nested_exception = java_exception.getCause()

        if nested_exception:
            return find_py4j_error_root_cause(nested_exception)
        return java_exception