code: def _path_to_module(path):
      """Convert a Python rules file path to an importable module name.
  
      For example, "rules/community/cloudtrail_critical_api_calls.py" becomes
      "rules.community.cloudtrail_critical_api_calls"
  
      Raises:
          NameError if a '.' appears anywhere in the path except the file extension.
      """
      base_name = os.path.splitext(path)[0]
      if "." in base_name:
          raise NameError(
              'Python file "{}" cannot be imported '
              'because of "." in the name'.format(path)
          )
      return base_name.replace("/", ".")
  
imports: import importlib
  import os
label_desc: Use image node_id 3 for calling a global function with example usage: _path_to_module(path) and returns: base_name