code: def get_encoding(obj):
      """Get encoding for python source file defining obj
  
      Returns None if obj is not defined in a sourcefile.
      """
      ofile = find_file(obj)
      # run contents of file through pager starting at line where the object
      # is defined, as long as the file isn't binary and is actually on the
      # filesystem.
      if ofile is None:
          return None
      elif ofile.endswith((".so", ".dll", ".pyd")):
          return None
      elif not os.path.isfile(ofile):
          return None
      else:
          # Print only text files, not extension binaries.  Note that
          # getsourcelines returns lineno with 1-offset and page() uses
          # 0-offset, so we must adjust.
          with stdlib_io.open(
              ofile, "rb"
          ) as buffer:  # Tweaked to use io.open for Python 2
              encoding, lines = openpy.detect_encoding(buffer.readline)
          return encoding
  
imports: from __future__ import print_function
  import inspect
  import linecache
  import warnings
  import os
  from textwrap import dedent
  import types
  import io
  from IPython.core import page
  from IPython.lib.pretty import pretty
  from IPython.testing.skipdoctest import skip_doctest_py3
  from IPython.utils import PyColorize
  from IPython.utils import openpy
  from IPython.utils import py3compat
  from IPython.utils.dir2 import safe_hasattr
  from IPython.utils.path import compress_user
  from IPython.utils.text import indent
  from IPython.utils.wildcard import list_namespace
  from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable
  from IPython.utils.py3compat import cast_unicode, string_types, PY3
  from IPython.utils.signatures import signature
  from IPython.utils.colorable import Colorable
  from pygments import highlight
  from pygments.formatters import HtmlFormatter
label_desc: Use image node_id 3 for calling a global function with example usage: get_encoding(obj) and returns: None, None, None, encoding