+class TreeEntry(object):
+ default_mode = 0444
+
+ def __new__(cls, contents, mode=None):
+ return super(TreeEntry, cls).__new__(cls, contents)
+
+ def __init__(self, contents, mode=None):
+ if mode is None:
+ self.mode = self.default_mode
+ else:
+ self.mode = mode
+
+ super(TreeEntry, self).__init__(contents)
+
+class Directory(TreeEntry, list):