docs: def _send(saltdata, metric_base, opts):
      '''
      Send the data to carbon
      '''
  
      host = opts.get('host')
      port = opts.get('port')
      skip = opts.get('skip')
      metric_base_pattern = opts.get('carbon.metric_base_pattern')
      mode = opts.get('mode').lower() if 'mode' in opts else 'text'
  
      log.debug('Carbon minion configured with host: %s:%s', host, port)
      log.debug('Using carbon protocol: %s', mode)
  
      if not (host and port):
          log.error('Host or port not defined')
          return
  
      # TODO: possible to use time return from salt job to be slightly more precise?
      # convert the jid to unix timestamp?
      # {'fun': 'test.version', 'jid': '20130113193949451054', 'return': '0.11.0', 'id': 'salt'}
      timestamp = int(time.time())
  
      handler = _send_picklemetrics if mode == 'pickle' else _send_textmetrics
      metrics = []
      log.trace('Carbon returning walking data: %s', saltdata)
      _walk(metric_base, saltdata, metrics, timestamp, skip)
      data = handler(metrics)
      log.trace('Carbon inserting data: %s', data)
  
      with _carbon(host, port) as sock:
          total_sent_bytes = 0
          while total_sent_bytes < len(data):
              sent_bytes = sock.send(data[total_sent_bytes:])
              if sent_bytes == 0:
                  log.error('Bytes sent 0, Connection reset?')
                  return
  
              log.debug('Sent %s bytes to carbon', sent_bytes)
              total_sent_bytes += sent_bytes