def mbasename(s):
 base = os.path.basename(s)
 if base.endswith('.py'):
  base = base[:(-3)]
 if (base in set(['base', '__init__'])):
  base = ((os.path.basename(os.path.dirname(s)) + '.') + base)
 return base

def mbasename ( s ) : base = os . path . basename ( s ) if base . endswith ( '.py' ) : base = base [ : ( - 3 ) ] if ( base in set ( [ 'base' , '__init__' ] ) ) : base = ( ( os . path . basename ( os . path . dirname ( s ) ) + '.' ) + base ) return base
custom function to include directory name if filename is too common also strip .