def getHandleErrorCodeMatcher(self):
        """
        Return a L{hamcrest.core.matcher.Matcher} that matches the
        errno expected to result from writing to a closed platform
        socket handle.
        """
        # Windows and Python 3: returns WSAENOTSOCK
        # Windows and Python 2: returns EBADF
        # Linux, FreeBSD, macOS: returns EBADF
        if platform.isWindows() and _PY3:
            return hamcrest.equal_to(errno.WSAENOTSOCK)
        return hamcrest.equal_to(errno.EBADF)

        Return a L{hamcrest.core.matcher.Matcher} that matches the
        errno expected to result from writing to a closed platform
        socket handle.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_tcp.py