<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_output_folder(folder_path, pmids=None, extra_annotations=None, add_grounding=True):
 """Recursively extracts statements from all ISI output files in the given directory and subdirectories. Parameters folder_path : str The directory to traverse pmids : Optional[str] PMID mapping to be added to the Evidence of the extracted INDRA Statements extra_annotations : Optional[dict] Additional annotations to add to the Evidence object of all extracted INDRA statements. Extra annotations called 'interaction' are ignored since this is used by the processor to store the corresponding raw ISI output. add_grounding : Optional[bool] If True the extracted Statements' grounding is mapped """

    pmids = pmids if pmids is not None else {}
    extra_annotations = extra_annotations if \
        extra_annotations is not None else {}
    ips = []
    for entry in glob.glob(os.path.join(folder_path, '*.json')):
        entry_key = os.path.splitext(os.path.basename(entry))[0]
        # Extract the corresponding file id
        pmid = pmids.get(entry_key)
        extra_annotation = extra_annotations.get(entry_key)
        ip = process_json_file(entry, pmid, extra_annotation, False)
        ips.append(ip)

    if len(ips) > 1:
        for ip in ips[1:]:
            ips[0].statements += ip.statements

    if ips:
        if add_grounding:
            ips[0].add_grounding()
        return ips[0]
    else:
        return None