def open(self, mode='r'):
        """
        Open this file using C{mode} or for writing if C{alwaysCreate} is
        C{True}.

        In all cases the file is opened in binary mode, so it is not necessary
        to include C{"b"} in C{mode}.

        @param mode: The mode to open the file in.  Default is C{"r"}.
        @type mode: L{str}
        @raises AssertionError: If C{"a"} is included in the mode and
            C{alwaysCreate} is C{True}.
        @rtype: L{file}
        @return: An open L{file} object.
        """
        if self.alwaysCreate:
            assert 'a' not in mode, ("Appending not supported when "
                                     "alwaysCreate == True")
            return self.create()
        # This hack is necessary because of a bug in Python 2.7 on Windows:
        # http://bugs.python.org/issue7686
        mode = mode.replace('b', '')
        return open(self.path, mode + 'b')

        Open this file using C{mode} or for writing if C{alwaysCreate} is
        C{True}.

        In all cases the file is opened in binary mode, so it is not necessary
        to include C{"b"} in C{mode}.

        @param mode: The mode to open the file in.  Default is C{"r"}.
        @type mode: L{str}
        @raises AssertionError: If C{"a"} is included in the mode and
            C{alwaysCreate} is C{True}.
        @rtype: L{file}
        @return: An open L{file} object.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/filepath.py