def rwx(mode, aclBit=False):
 bools = expand_mode(mode)
 s = list('rwxrwxrwxt')
 for (i, v) in enumerate(bools[:(-1)]):
  if (not v):
   s[i] = '-'
 if (not bools[(-1)]):
  s = s[:(-1)]
 return ((rwxtype(mode) + ''.join(s)) + ('+' if aclBit else ''))

def rwx ( mode , aclBit = False ) : bools = expand_mode ( mode ) s = list ( 'rwxrwxrwxt' ) for ( i , v ) in enumerate ( bools [ : ( - 1 ) ] ) : if ( not v ) : s [ i ] = '-' if ( not bools [ ( - 1 ) ] ) : s = s [ : ( - 1 ) ] return ( ( rwxtype ( mode ) + '' . join ( s ) ) + ( '+' if aclBit else '' ) )
returns "rwx"-style string like that ls would give you .