'Send the bytes data from a bytes-like object'

def send_bytes(self, buf, offset=0, size=None):

    self._check_closed()
    self._check_writable()
    m = memoryview(buf)
    if (m.itemsize > 1):
        m = memoryview(bytes(m))
    n = len(m)
    if (offset < 0):
        raise ValueError('offset    is    negative')
    if (n < offset):
        raise ValueError('buffer    length    <    offset')
    if (size is None):
        size = (n - offset)
    elif (size < 0):
        raise ValueError('size    is    negative')
    elif ((offset + size) > n):
        raise ValueError('buffer    length    <    offset    +    size')
    self._send_bytes(m[offset:(offset + size)])
