code: def media_to_html(
      media_type: str,
      media_source: Union[str, bytes],
      file_type: Optional[str] = None,
  ) -> str:
      """
      Convert a media file to an HTML tag with embedded base64 data.
  
      Args:
          media_type: The type of media to convert. Can be one of 'video', 'audio', or 'image'.
          media_source: The path to the media file or a non-b64 encoded byte string.
          file_type: The type of the media file. If not provided, it will be inferred from the file extension.
  
      Returns:
          HTML tag with embedded base64 data.
  
      Raises:
          FileNotFoundError: If the file does not exist or is empty.
          ValueError: If no provided file type using bytes as input or the file type is not supported.
      """
  
      if isinstance(media_source, bytes):
          if not file_type:
              raise ValueError(
                  "File type must be provided if media source is a byte string."
              )
  
          file_data = media_source
  
      else:
          file_path = Path(media_source)
  
          if not file_path.exists() or file_path.stat().st_size == 0:
              raise FileNotFoundError(
                  f"File {file_path} does not exist or is empty."
              )
  
          if not file_type:
              file_type = file_path.suffix[1:].lower()
  
          file_data = file_path.read_bytes()
  
      if len(file_data) > 5000000:
          raise ValueError(
              f"File size is {len(file_data)} bytes. It is recommended to use files smaller than 5MB, as larger files might not render properly."
          )
  
      if file_type not in SUPPORTED_MEDIA_TYPES[media_type]:
          raise ValueError(
              f"Unsupported {media_type} type: {file_type}. Supported types are {SUPPORTED_MEDIA_TYPES[media_type]}"
          )
  
      if file_type == "ogg":
          warnings.warn(
              "'ogg' files might not be supported in Safari.",
              category=UserWarning,
          )
  
      media_base64 = base64.b64encode(file_data).decode("utf-8")
  
      data_url = f"data:{media_type}/{file_type};base64,{media_base64}"
  
      if media_type == "video":
          html = f"<video controls><source src='{data_url}' type='video/{file_type}'></video>"
      elif media_type == "audio":
          html = f"<audio controls><source src='{data_url}' type='audio/{file_type}'></audio>"
      elif media_type == "image":
          html = f'<img src="{data_url}">'
      else:
          raise ValueError(
              f"Unsupported media type: {media_type}"
          )  # Technically unreachable
  
      return html
  
file_path: argilla/src/argilla/client/feedback/utils/html_utils.py
imports: import base64
  import warnings
  from pathlib import Path
  from typing import Callable, List, Optional, Union
  from argilla.utils.dependency import require_dependencies
label_desc: Use image node_id 1 for calling a global function with example usage: media_to_html(media_type, media_source, file_type) and returns: html