def METHOD_NAME(self):
    perms = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH|((S_IWGRP|S_ISGID) if self.coursedir.groupshared else 0)
    # if root doesn't exist, create it and set permissions
    if not os.path.exists(self.root):
        self.log.warning("Creating exchange directory: {}".format(self.root))
        try:
            os.makedirs(self.root)
            os.chmod(self.root, perms)
        except PermissionError:
            self.fail("Could not create {}, permission denied.".format(self.root))
    else:
        old_perms = oct(os.stat(self.root)[ST_MODE] & 0o777)
        new_perms = oct(perms & 0o777)
        if old_perms != new_perms:
            self.log.warning(
                "Permissions for exchange directory ({}) are invalid, changing them from {} to {}".format(
                    self.root, old_perms, new_perms))
            try:
                os.chmod(self.root, perms)
            except PermissionError:
                self.fail("Could not change permissions of {}, permission denied.".format(self.root))