code: def to_pipeline_file(stage):
      """Validate schema on each serialization."""
      e = _to_pipeline_file(stage)
      assert len(Schema(e)) == 1
      return e
  
imports: import os
  import pytest
  from voluptuous import Schema
  from dvc import output
  from dvc.dvcfile import PROJECT_FILE
  from dvc.schema import SINGLE_PIPELINE_STAGE_SCHEMA
  from dvc.stage import PipelineStage, create_stage
  from dvc.stage.serialize import to_pipeline_file
label_desc: Use image node_id 1 for calling a global function with example usage: to_pipeline_file(stage) and returns: e