def getsourcefile(object):
 filename = getfile(object)
 if (string.lower(filename[(-4):]) in ('.pyc', '.pyo')):
  filename = (filename[:(-4)] + '.py')
 for (suffix, mode, kind) in imp.get_suffixes():
  if (('b' in mode) and (string.lower(filename[(- len(suffix)):]) == suffix)):
   return None
 if os.path.exists(filename):
  return filename
 if hasattr(getmodule(object, filename), '__loader__'):
  return filename

def getsourcefile ( object ) : filename = getfile ( object ) if ( string . lower ( filename [ ( - 4 ) : ] ) in ( '.pyc' , '.pyo' ) ) : filename = ( filename [ : ( - 4 ) ] + '.py' ) for ( suffix , mode , kind ) in imp . get_suffixes ( ) : if ( ( 'b' in mode ) and ( string . lower ( filename [ ( - len ( suffix ) ) : ] ) == suffix ) ) : return None if os . path . exists ( filename ) : return filename if hasattr ( getmodule ( object , filename ) , '__loader__' ) : return filename
return the filename that can be used to locate an objects source .