def filemode(mode):
perm = []<EOL>for table in filemode_table:<EOL><INDENT>for bit, char in table:<EOL><INDENT>if mode & bit == bit:<EOL><INDENT>perm.append(char)<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>perm.append("<STR_LIT:->")<EOL><DEDENT><DEDENT>return "<STR_LIT>".join(perm)<EOL>
Convert a file's mode to a string of the form
       -rwxrwxrwx.
       Used by TarFile.list()