def _recurse(
    text: str,
    split_on: str,
    wrapper: str,
    replacer: str,
    inner=False,
) -> str:
    """Take a string, split it, then build a new string from the parts.

    The position of the character used to split the original string will be
    replaced in the new string by cap.

    Arguments:
        text (str): Text block to scan.
        split_on (str): A character to remove via splitting.
        wrapper (str): The wrapper for each sub-block.
        replacer (str): The replacement for the removed character.
        inner (bool): True if already inside a sub-block.

    Returns:
        str

    """
    final_value = ""
    split_text = text.split(split_on)

    # Ignore single length split lists in nested searches.
    if inner and len(split_text) <= 1:
        return

    for index, item in enumerate(split_text):
        # Check every block of text for a single quotation mark
        sub_block = _recurse(
            item,
            split_on="'",
            wrapper='"{}",',
            replacer='"\'",',
            inner=True,
        )

        if sub_block:
            final_value += sub_block

        else:
            final_value += wrapper.format(item)

        # Don't cap the last item in the block.
        if index != len(split_text) - 1:
            final_value += replacer

    return final_value
Take a string, split it, then build a new string from the parts.

    The position of the character used to split the original string will be
    replaced in the new string by cap.

    Arguments:
        text (str): Text block to scan.
        split_on (str): A character to remove via splitting.
        wrapper (str): The wrapper for each sub-block.
        replacer (str): The replacement for the removed character.
        inner (bool): True if already inside a sub-block.

    Returns:
        str

    
splinter/driver/xpath_utils.py