'Write the given bytes or bytearray object *b* to the socket
and return the number of bytes written.  This can be less than
len(b) if not all data could be written.  If the socket is
non-blocking and no bytes could be written None is returned.'

def write(self, b):

    self._checkClosed()
    self._checkWritable()
    try:
        return self._sock.send(b)
    except error as e:
        if (e.args[0] in _blocking_errnos):
            return None
        raise
