<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_dir(self, path, compress):
 """Add all files under directory `path` to the MAR file. Args: path (str):
 path to directory to add to this MAR file compress (str):
 One of 'xz', 'bz2', or None. Defaults to None. """

        if not os.path.isdir(path):
            raise ValueError('{} is not a directory'.format(path))
        for root, dirs, files in os.walk(path):
            for f in files:
                self.add_file(os.path.join(root, f), compress)