def get_init(dirname):
 fbase = os.path.join(dirname, '__init__')
 for ext in ['.py', '.pyw']:
  fname = (fbase + ext)
  if os.path.isfile(fname):
   return fname

def get_init ( dirname ) : fbase = os . path . join ( dirname , '__init__' ) for ext in [ '.py' , '.pyw' ] : fname = ( fbase + ext ) if os . path . isfile ( fname ) : return fname
get __init__ file path for module directory parameters dirname : str find the __init__ file in directory dirname returns init_path : str path to __init__ file .