<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dirs(self, before=time.time(), exited=True):
 """ Provider a generator of container state directories. If exited is None, all are returned. If it is False, unexited containers are returned. If it is True, only exited containers are returned. """

        timestamp = iso(before)
        root = os.path.join(self.root, "start-time")
        os.chdir(root)
        by_t = (d for d in glob.iglob("????-??-??T*.*Z") if d < timestamp)
        if exited is None:
            def predicate(directory):
                return True
        else:
            def predicate(directory):
                exit = os.path.join(directory, "exit")
                return os.path.exists(exit) is exited
        return (os.path.join(root, d) for d in by_t if predicate(d))