def _files_preserve(self):
        """ create a set of protected files

        create a set of files, based on self.files_preserve and
        self.stdin, self,stdout and self.stderr, that should not get
        closed while daemonizing.

        :return: set
        """
        result = set()
        files = [] if not self.files_preserve else self.files_preserve
        files.extend([self.stdin, self.stdout, self.stderr])
        for item in files:
            if hasattr(item, 'fileno'):
                result.add(item.fileno())
            if isinstance(item, int):
                result.add(item)
        return result
create a set of protected files

        create a set of files, based on self.files_preserve and
        self.stdin, self,stdout and self.stderr, that should not get
        closed while daemonizing.

        :return: set