code: def getsource(obj, oname=""):
      """Wrapper around inspect.getsource.
  
      This can be modified by other projects to provide customized source
      extraction.
  
      Parameters
      ----------
      obj : object
          an object whose source code we will attempt to extract
      oname : str
          (optional) a name under which the object is known
  
      Returns
      -------
      src : unicode or None
  
      """
  
      if isinstance(obj, property):
          sources = []
          for attrname in ["fget", "fset", "fdel"]:
              fn = getattr(obj, attrname)
              if fn is not None:
                  encoding = get_encoding(fn)
                  oname_prefix = ("%s." % oname) if oname else ""
                  sources.append(
                      cast_unicode(
                          "".join(("# ", oname_prefix, attrname)),
                          encoding=encoding,
                      )
                  )
                  if inspect.isfunction(fn):
                      sources.append(dedent(getsource(fn)))
                  else:
                      # Default str/repr only prints function name,
                      # pretty.pretty prints module name too.
                      sources.append(
                          cast_unicode(
                              "%s%s = %s\n"
                              % (oname_prefix, attrname, pretty(fn)),
                              encoding=encoding,
                          )
                      )
          if sources:
              return "\n".join(sources)
          else:
              return None
  
      else:
          # Get source for non-property objects.
  
          obj = _get_wrapped(obj)
  
          try:
              src = inspect.getsource(obj)
          except TypeError:
              # The object itself provided no meaningful source, try looking for
              # its class definition instead.
              if hasattr(obj, "__class__"):
                  try:
                      src = inspect.getsource(obj.__class__)
                  except TypeError:
                      return None
  
          encoding = get_encoding(obj)
          return cast_unicode(src, encoding=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 5 for calling a global function with example usage: getsource(obj, oname) and returns: cast_unicode, str, None, None