def _raise_if_not_writable(self, unacknowledged):
        """Raise NotMasterError on unacknowledged write if this socket is not
        writable.
        """
        if unacknowledged and not self.is_writable:
            # Write won't succeed, bail as if we'd received a not master error.
            raise NotMasterError("not master", {
                "ok": 0, "errmsg": "not master", "code": 10107})
Raise NotMasterError on unacknowledged write if this socket is not
        writable.
        
stackoverflow/venv/lib/python3.6/site-packages/pymongo/pool.py