code: def send(self, msg, timeout=None):
          
          log.debug("We've been asked to write a message to the bus")
          logger_tx = log.getChild("tx")
          logger_tx.debug("sending: %s", msg)
  
          started = time.time()
          # If no timeout is given, poll for availability
          if timeout is None:
              timeout = 0
          time_left = timeout
          data = build_can_frame(msg)
  
          while time_left >= 0:
              # Wait for write availability
              ready = select.select([], [self.socket], [], time_left)[1]
              if not ready:
                  # Timeout
                  break
              sent = self._send_once(data, msg.channel)
              if sent == len(data):
                  return
              # Not all data were sent, try again with remaining data
              data = data[sent:]
              time_left = timeout - (time.time() - started)
  
          raise can.CanError("Transmit buffer full")
docs: Transmit a message to the CAN bus.
  
          :param can.Message msg: A message object.
          :param float timeout:
              Wait up to this many seconds for the transmit queue to be ready.
              If not given, the call may fail immediately.
  
          :raises can.CanError:
              if the message could not be written.