code: def validate_and_convert_nexson(nexson, output_version, allow_invalid, **kwargs):
      
      try:
          if TRACE_FILES:
              _write_to_next_free('input', nexson)
          annotation, validation_log, nexson_adaptor = ot_validate(nexson, **kwargs)
          if TRACE_FILES:
              _write_to_next_free('annotation', annotation)
      except:
          msg = 'exception in ot_validate: ' + traceback.format_exc()
          raise GitWorkflowError(msg)
      if (not allow_invalid) and validation_log.has_error():
          raise GitWorkflowError('ot_validation failed: ' + json.dumps(annotation))
      nexson = convert_nexson_format(nexson, output_version)
      if TRACE_FILES:
          _write_to_next_free('converted', nexson)
      return nexson, annotation, validation_log, nexson_adaptor
docs: Runs the nexson validator and returns a converted 4 object:
          nexson, annotation, validation_log, nexson_adaptor
  
      `nexson` is the nexson dict.
      `output_version` is the version of nexson syntax to be used after validation.
      if `allow_invalid` is False, and the nexson validation has errors, then
          a GitWorkflowError will be generated before conversion.