<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mknod(self, filename, mode=None, device=None, dir_fd=None):
 """Create a filesystem node named 'filename'. Does not support device special files or named pipes as the real os module does. Args: filename: (str) Name of the file to create mode: (int) Permissions to use and type of file to be created. Default permissions are 0o666. Only the stat.S_IFREG file type is supported by the fake implementation. The umask is applied to this mode. device: not supported in fake implementation dir_fd: If not `None`, the file descriptor of a directory, with `filename` being relative to this directory. New in Python 3.3. Raises: OSError: if called with unsupported options or the file can not be created. """

        if self.filesystem.is_windows_fs:
            raise(AttributeError, "module 'os' has no attribute 'mknode'")
        if mode is None:
            # note that a default value of 0o600 without a device type is
            # documented - this is not how it seems to work
            mode = S_IFREG | 0o600
        if device or not mode & S_IFREG and not is_root():
            self.filesystem.raise_os_error(errno.EPERM)

        filename = self._path_with_dir_fd(filename, self.mknod, dir_fd)
        head, tail = self.path.split(filename)
        if not tail:
            if self.filesystem.exists(head, check_link=True):
                self.filesystem.raise_os_error(errno.EEXIST, filename)
            self.filesystem.raise_os_error(errno.ENOENT, filename)
        if tail in (b'.', u'.', b'..', u'..'):
            self.filesystem.raise_os_error(errno.ENOENT, filename)
        if self.filesystem.exists(filename, check_link=True):
            self.filesystem.raise_os_error(errno.EEXIST, filename)
        try:
            self.filesystem.add_object(head, FakeFile(
                tail, mode & ~self.filesystem.umask,
                filesystem=self.filesystem))
        except IOError as e:
            self.filesystem.raise_os_error(e.errno, filename)