def get_section_from_report(report: str, section: str): section_upper = section.upper() section_lower = section.lower() findings_start_idx = report.lower().find(f"{section_lower}:") + len( f"{section_lower}:" ) if findings_start_idx == -1: findings_start_idx = report.lower().find(f"{section_lower}:") + len( f"{section_lower}:" ) if findings_start_idx == -1: findings_start_idx = report.find(f"{section_upper}") + len(f"{section_upper}") if findings_start_idx == -1: findings = report else: findings = report[findings_start_idx:] return findings