def filemode(mode):
 perm = []
 for table in _filemode_table:
  for (bit, char) in table:
   if ((mode & bit) == bit):
    perm.append(char)
    break
  else:
   perm.append('-')
 return ''.join(perm)

def filemode ( mode ) : perm = [ ] for table in _filemode_table : for ( bit , char ) in table : if ( ( mode & bit ) == bit ) : perm . append ( char ) break else : perm . append ( '-' ) return '' . join ( perm )
convert a files mode to a string of the form -rwxrwxrwx .