code: def get_preferred_backend():
      default_dir = None
      if "DGLDEFAULTDIR" in os.environ:
          default_dir = os.getenv("DGLDEFAULTDIR")
      else:
          default_dir = os.path.join(os.path.expanduser("~"), ".dgl")
      config_path = os.path.join(default_dir, "config.json")
      backend_name = None
      if "DGLBACKEND" in os.environ:
          backend_name = os.getenv("DGLBACKEND")
      elif os.path.exists(config_path):
          with open(config_path, "r") as config_file:
              config_dict = json.load(config_file)
              backend_name = config_dict.get("backend", "").lower()
  
      if backend_name in ["tensorflow", "mxnet", "pytorch"]:
          return backend_name
      else:
          print(
              "DGL backend not selected or invalid.  "
              "Assuming PyTorch for now.",
              file=sys.stderr,
          )
          set_default_backend(default_dir, "pytorch")
          return "pytorch"
  
file_path: dgl/python/dgl/backend/__init__.py
imports: from __future__ import absolute_import
  import importlib
  import json
  import logging
  import os
  import sys
  from .None import backend
  from .set_default_backend import set_default_backend
label_desc: Use image node_id 3 for calling a global function with example usage: get_preferred_backend() and returns: backend_name, str