code: def get_provider_id_from_relative_import_or_file(
      relative_path_or_file: str,
  ) -> str | None:
      provider_candidate = relative_path_or_file.replace(
          os.sep, "."
      ).split(".")
      while provider_candidate:
          candidate_provider_id = ".".join(provider_candidate)
          if candidate_provider_id in ALL_PROVIDERS:
              return candidate_provider_id
          provider_candidate = provider_candidate[:-1]
      return None
  
imports: from __future__ import annotations
  import hashlib
  import json
  import os
  import sys
  from ast import Import, ImportFrom, NodeVisitor, parse
  from collections import defaultdict
  from enum import Enum
  from pathlib import Path
  from typing import Any, List
  import yaml
  from rich.console import Console
label_desc: Use image node_id 2 for calling a global function with example usage: get_provider_id_from_relative_import_or_file(relative_path_or_file) and returns: None, candidate_provider_id