code: def _rewrite_test(config, name):
      """Try to read and rewrite *fn* and return the code object."""
      state = _get_state(config)
  
      source = importer.get_source(name)
      if source is None:
          return None
  
      path = importer.get_filename(name)
  
      try:
          tree = ast.parse(source, filename=path)
      except SyntaxError:
          # Let this pop up again in the real import.
          state.trace("failed to parse: %r" % (path,))
          return None
      rewrite.rewrite_asserts(tree, py.path.local(path), config)
      try:
          co = compile(tree, path, "exec", dont_inherit=True)
      except SyntaxError:
          # It's possible that this error is from some bug in the
          # assertion rewriting, but I don't know of a fast way to tell.
          state.trace("failed to compile: %r" % (path,))
          return None
      return co
  
file_path: catboost/library/python/pytest/rewrite.py
imports: from __future__ import absolute_import
  from __future__ import print_function
  import ast
  import py
  from _pytest.assertion import rewrite
  from __res import importer
  import sys
  import six
label_desc: Use image node_id 2 for calling a global function with example usage: _rewrite_test(config, name) and returns: co, None, None, None