def upload_training_video(videos, api_key=None, env_id=None):
 with tempfile.TemporaryFile() as archive_file:
  write_archive(videos, archive_file, env_id=env_id)
  archive_file.seek(0)
  logger.info('[%s] Uploading videos of %d training episodes (%d bytes)', env_id, len(videos), util.file_size(archive_file))
  file_upload = resource.FileUpload.create(purpose='video', content_type='application/vnd.openai.video+x-compressed', api_key=api_key)
  file_upload.put(archive_file, encode=None)
 return file_upload

def upload_training_video ( videos , api_key = None , env_id = None ) : with tempfile . TemporaryFile ( ) as archive_file : write_archive ( videos , archive_file , env_id = env_id ) archive_file . seek ( 0 ) logger . info ( '[%s] Uploading videos of %d training episodes (%d bytes)' , env_id , len ( videos ) , util . file_size ( archive_file ) ) file_upload = resource . FileUpload . create ( purpose = 'video' , content_type = 'application/vnd.openai.video+x-compressed' , api_key = api_key ) file_upload . put ( archive_file , encode = None ) return file_upload
videos: should be list of tuples .