Returns a new temporary file.

        The return value is a pair (fd, path) where fd is the file descriptor
        returned by :func:`os.open`, and path is a :class:`~rpaths.Path` to it.

        :param suffix: If specified, the file name will end with that suffix,
            otherwise there will be no suffix.

        :param prefix: Is specified, the file name will begin with that prefix,
            otherwise a default prefix is used.

        :param dir: If specified, the file will be created in that directory,
            otherwise a default directory is used.

        :param text: If true, the file is opened in text mode. Else (the
            default) the file is opened in binary mode.  On some operating
            systems, this makes no difference.

        The file is readable and writable only by the creating user ID.
        If the operating system uses permission bits to indicate whether a
        file is executable, the file is executable by no one. The file
        descriptor is not inherited by children of this process.

        The caller is responsible for deleting the file when done with it.

def tempfile(cls, suffix='', prefix=None, dir=None, text=False):
        """Returns a new temporary file.

        The return value is a pair (fd, path) where fd is the file descriptor
        returned by :func:`os.open`, and path is a :class:`~rpaths.Path` to it.

        :param suffix: If specified, the file name will end with that suffix,
            otherwise there will be no suffix.

        :param prefix: Is specified, the file name will begin with that prefix,
            otherwise a default prefix is used.

        :param dir: If specified, the file will be created in that directory,
            otherwise a default directory is used.

        :param text: If true, the file is opened in text mode. Else (the
            default) the file is opened in binary mode.  On some operating
            systems, this makes no difference.

        The file is readable and writable only by the creating user ID.
        If the operating system uses permission bits to indicate whether a
        file is executable, the file is executable by no one. The file
        descriptor is not inherited by children of this process.

        The caller is responsible for deleting the file when done with it.
        """
        if prefix is None:
            prefix = tempfile.template
        if dir is not None:
            # Note that this is not safe on Python 2
            # There is no work around, apart from not using the tempfile module
            dir = str(Path(dir))
        fd, filename = tempfile.mkstemp(suffix, prefix, dir, text)
        return fd, cls(filename).absolute()