code: func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
  	if emitter.events_head == len(emitter.events) {
  		return true
  	}
  	var accumulate int
  	switch emitter.events[emitter.events_head].typ {
  	case yaml_DOCUMENT_START_EVENT:
  		accumulate = 1
  		break
  	case yaml_SEQUENCE_START_EVENT:
  		accumulate = 2
  		break
  	case yaml_MAPPING_START_EVENT:
  		accumulate = 3
  		break
  	default:
  		return false
  	}
  	if len(emitter.events)-emitter.events_head > accumulate {
  		return false
  	}
  	var level int
  	for i := emitter.events_head; i < len(emitter.events); i++ {
  		switch emitter.events[i].typ {
  		case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT:
  			level++
  		case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT:
  			level--
  		}
  		if level == 0 {
  			return false
  		}
  	}
  	return true
  }
docs: // Check if we need to accumulate more events before emitting.
  //
  // We accumulate extra
  //  - 1 event for DOCUMENT-START
  //  - 2 events for SEQUENCE-START
  //  - 3 events for MAPPING-START
  //