code: def rename_imports(
      mapping: Mapping[str, str], contents: Iterable[str]
  ) -> Tuple[int, List[str]]:
      final_lines = []
      edit_count = 0
      for line in contents:
          # filter
          test_line = line.strip()
          if (
              test_line.startswith("import")
              or test_line.startswith("from")
          ) and not any(exc in test_line for exc in _exceptions):
              edited_line = line
              for old_, new_ in mapping.items():
                  edited_line = edited_line.replace(old_, new_, 1)
              final_lines.append(edited_line)
              if line != edited_line:
                  edit_count += 1
          else:
              final_lines.append(line)
      return edit_count, final_lines
  
imports: import glob
  import os
  from pathlib import Path
  from typing import Mapping, Iterable, List, Tuple, Union
  from fedot.core.utils import fedot_project_root
label_desc: Use image node_id 1 for calling a global function with example usage: rename_imports(mapping, contents) and returns: edit_count,  final_lines