code: def _image_to_bytes(x: torch.Tensor, **kwargs) -> io.BytesIO:
      """
      Take an image in [0, 1] and save it as file bytes using PIL.
  
      Args:
          x: an image tensor in [C, H, W] order, where C is the number of channels,
              and H, W are the height and width.
          kwargs: any keyword arguments that can be passed to PIL's Image.save().
  
      Returns:
          The file bytes.
  
      """
      assert x.min() >= 0
      assert x.max() <= 1
      x = (
          (x * 255).byte().permute(1, 2, 0).cpu().numpy()
      )  # Bytes in H, W, C order
  
      img = Image.fromarray(x)
      byte_array = io.BytesIO()
  
      img.save(byte_array, **kwargs)
      return byte_array
  
imports: import argparse
  import io
  from typing import Dict, Union
  import numpy
  import torch
  from PIL import Image
  from data.transforms import TRANSFORMATIONS_REGISTRY, BaseTransformation
label_desc: Use image node_id 1 for calling a global function with example usage: _image_to_bytes(x) and returns: byte_array