code: def temp_video(
      num_frames,
      height,
      width,
      fps,
      lossless=False,
      video_codec=None,
      options=None,
  ):
      if lossless:
          if video_codec is not None:
              raise ValueError(
                  "video_codec can't be specified together with lossless"
              )
          if options is not None:
              raise ValueError(
                  "options can't be specified together with lossless"
              )
          video_codec = "libx264rgb"
          options = {"crf": "0"}
  
      if video_codec is None:
          if get_video_backend() == "pyav":
              video_codec = "libx264"
          else:
              # when video_codec is not set, we assume it is libx264rgb which accepts
              # RGB pixel formats as input instead of YUV
              video_codec = "libx264rgb"
      if options is None:
          options = {}
  
      data = _create_video_frames(num_frames, height, width)
      with tempfile.NamedTemporaryFile(suffix=".mp4") as f:
          f.close()
          io.write_video(
              f.name,
              data,
              fps=fps,
              video_codec=video_codec,
              options=options,
          )
          yield f.name, data
      os.unlink(f.name)
  
imports: import contextlib
  import os
  import sys
  import tempfile
  import pytest
  import torch
  import torchvision.io
  from common_utils import assert_equal
  from torchvision import get_video_backend
label_desc: Use image node_id 2 for calling a global function with example usage: temp_video(num_frames, height, width, fps, lossless, video_codec, options) without return types