def chmod(self, path, mode, follow_symlinks=True):
        """Change the permissions of a file as encoded in integer mode.

        Args:
            path: (str) Path to the file.
            mode: (int) Permissions.
            follow_symlinks: If `False` and `path` points to a symlink,
                the link itself is affected instead of the linked object.
        """
        try:
            file_object = self.resolve(path, follow_symlinks, allow_fd=True)
        except IOError as io_error:
            if io_error.errno == errno.ENOENT:
                self.raise_os_error(errno.ENOENT, path)
            raise
        if self.is_windows_fs:
            if mode & PERM_WRITE:
                file_object.st_mode = file_object.st_mode | 0o222
            else:
                file_object.st_mode = file_object.st_mode & 0o777555
        else:
            file_object.st_mode = ((file_object.st_mode & ~PERM_ALL) |
                                   (mode & PERM_ALL))
        file_object.st_ctime = time.time()
Change the permissions of a file as encoded in integer mode.

        Args:
            path: (str) Path to the file.
            mode: (int) Permissions.
            follow_symlinks: If `False` and `path` points to a symlink,
                the link itself is affected instead of the linked object.