class_docstr: Custom loader which rewrites the source before loading it.
class_docstr_tok: ["Custom","loader","which","rewrites","the","source","before","loading","it","."]
code: def get_data(self, path):
      if DEBUG:
          print("Rewriting ", path)
  
      data = self._orig_loader.get_data(path).decode("utf-8")
  
      root_name = _root_name()
  
      if DEBUG:
          print("root_name ", root_name)
  
      data = re.sub(
          r"import {}([ \.])".format(root_name),
          r"import {}.dynamic.{}\1".format(
              root_name, self._backend_name
          ),
          data,
      )
      data = re.sub(
          r"from {}([ \.])".format(root_name),
          r"from {}.dynamic.{}\1".format(root_name, self._backend_name),
          data,
      )
      data = re.sub(
          "BACKEND = None",
          "BACKEND = '{}'".format(self._backend_name),
          data,
      )
  
      if DEBUG:
          print(data)
          print()
      return data.encode("utf-8")
  
file_path: probability/spinoffs/fun_mc/fun_mc/backends/rewrite.py
imports: import importlib
  import importlib.abc
  import importlib.machinery
  import importlib.util
  import re
  import sys
label_desc: Use image node_id 3 for calling the Loader obj's underlying member method code with example usage: obj.get_data(path) and returns: data