code: def as_tar_bytes(file_name, content):
      """Utility to encode the given string as a gzipped tar and return the bytes."""
      tar_fileobj = io.BytesIO()
      with tarfile.open(fileobj=tar_fileobj, mode="w|gz") as tar:
          content = content.encode("utf-8")
          tf = tarfile.TarInfo(file_name)
          tf.size = len(content)
          tar.addfile(tf, io.BytesIO(content))
      tar_fileobj.seek(0)
      return tar_fileobj.read()
  
file_path: pytorch-lightning/tests/tests_app/plugin/test_plugin.py
imports: import io
  import json
  import sys
  import tarfile
  from dataclasses import dataclass
  from pathlib import Path
  from unittest import mock
  import pytest
  from fastapi import status
  from fastapi.testclient import TestClient
  from lightning.app.plugin.plugin import _Run, _start_plugin_server
  from lightning_cloud.openapi import Externalv1LightningappInstance
label_desc: Use image node_id 3 for calling a global function with example usage: as_tar_bytes(file_name, content) and returns: tar_fileobj