def run_c_extension_with_fallback(
        log_function,
        extension,
        c_function,
        py_function,
        args,
        rconf
):
    """
    Run a function calling a C extension, falling back
    to a pure Python function if the former does not succeed.

    :param function log_function: a logger function
    :param string extension: the name of the extension
    :param function c_function: the (Python) function calling the C extension
    :param function py_function: the (Python) function providing the fallback
    :param rconf: the runtime configuration
    :type  rconf: :class:`aeneas.runtimeconfiguration.RuntimeConfiguration`
    :rtype: depends on the extension being called
    :raises: RuntimeError: if both the C extension and
                           the pure Python code did not succeed.

    .. versionadded:: 1.4.0
    """
    computed = False
    if not rconf[u"c_extensions"]:
        log_function(u"C extensions disabled")
    elif extension not in rconf:
        log_function([u"C extension '%s' not recognized", extension])
    elif not rconf[extension]:
        log_function([u"C extension '%s' disabled", extension])
    else:
        log_function([u"C extension '%s' enabled", extension])
        if c_function is None:
            log_function(u"C function is None")
        elif can_run_c_extension(extension):
            log_function([u"C extension '%s' enabled and it can be loaded", extension])
            computed, result = c_function(*args)
        else:
            log_function([u"C extension '%s' enabled but it cannot be loaded", extension])
    if not computed:
        if py_function is None:
            log_function(u"Python function is None")
        else:
            log_function(u"Running the pure Python code")
            computed, result = py_function(*args)
    if not computed:
        raise RuntimeError(u"Both the C extension and the pure Python code failed. (Wrong arguments? Input too big?)")
    return result
Run a function calling a C extension, falling back
    to a pure Python function if the former does not succeed.

    :param function log_function: a logger function
    :param string extension: the name of the extension
    :param function c_function: the (Python) function calling the C extension
    :param function py_function: the (Python) function providing the fallback
    :param rconf: the runtime configuration
    :type  rconf: :class:`aeneas.runtimeconfiguration.RuntimeConfiguration`
    :rtype: depends on the extension being called
    :raises: RuntimeError: if both the C extension and
                           the pure Python code did not succeed.

    .. versionadded:: 1.4.0