code: def _load_data(file, yaml_loader):
      try:
          import yaml
  
          loader = getattr(yaml, yaml_loader)  # not tested
          return yaml.load(file, Loader=loader)  # not tested
      except ImportError:
          import json
  
          return json.load(file)
  
imports: import io
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: _load_data(file, yaml_loader) and returns: yaml, json