def get_directory(filename):
 if filename.endswith('.tar.gz'):
  return basename(filename[:(-7)])
 elif filename.endswith('.tgz'):
  return basename(filename[:(-4)])
 elif filename.endswith('.tar.bz2'):
  return basename(filename[:(-8)])
 elif filename.endswith('.tbz2'):
  return basename(filename[:(-5)])
 elif filename.endswith('.zip'):
  return basename(filename[:(-4)])
 info('Unknown file extension for {}'.format(filename))
 exit(1)

def get_directory ( filename ) : if filename . endswith ( '.tar.gz' ) : return basename ( filename [ : ( - 7 ) ] ) elif filename . endswith ( '.tgz' ) : return basename ( filename [ : ( - 4 ) ] ) elif filename . endswith ( '.tar.bz2' ) : return basename ( filename [ : ( - 8 ) ] ) elif filename . endswith ( '.tbz2' ) : return basename ( filename [ : ( - 5 ) ] ) elif filename . endswith ( '.zip' ) : return basename ( filename [ : ( - 4 ) ] ) info ( 'Unknown file extension for {}' . format ( filename ) ) exit ( 1 )
if the filename ends with a recognised file extension .