def getsource(obj):
 try:
  try:
   src = encoding.to_unicode(inspect.getsource(obj))
  except TypeError:
   if hasattr(obj, '__class__'):
    src = encoding.to_unicode(inspect.getsource(obj.__class__))
   else:
    src = getdoc(obj)
  return src
 except (TypeError, IOError):
  return

def getsource ( obj ) : try : try : src = encoding . to_unicode ( inspect . getsource ( obj ) ) except TypeError : if hasattr ( obj , '__class__' ) : src = encoding . to_unicode ( inspect . getsource ( obj . __class__ ) ) else : src = getdoc ( obj ) return src except ( TypeError , IOError ) : return
wrapper around inspect .