code: def send_bcm(bcm_socket, data):
      
      try:
          return bcm_socket.send(data)
      except OSError as e:
          base = "Couldn't send CAN BCM frame. OS Error {}: {}\n".format(e.errno, e.strerror)
  
          if e.errno == errno.EINVAL:
              raise can.CanError(base + "You are probably referring to a non-existing frame.")
  
          elif e.errno == errno.ENETDOWN:
              raise can.CanError(base + "The CAN interface appears to be down.")
  
          elif e.errno == errno.EBADF:
              raise can.CanError(base + "The CAN socket appears to be closed.")
  
          else:
              raise e
docs: Send raw frame to a BCM socket and handle errors.