def get_file_data(
    file_source: Union[str, bytes], file_type: Optional[str] = None, media_type: Optional[str] = None
) -> bytes:
    """
    Utility function to check the input file and get the file data as bytes.

    Args:
        file_source: The path to the media file or a non-b64 encoded byte string.
        file_type: The type of the video file. If not provided, it will be inferred from the file extension.
        media_type: Type of media ('video', 'audio', or 'image').

    Returns:
        File data as bytes.

    Raises:
        FileNotFoundError: If the file does not exist or is empty.
        ValueError: If no provided file type using bytes as input, the file type does not match the expected extension or the file size is too large (>5MB).
    """
    if isinstance(file_source, bytes):
        if not file_type:
            raise ValueError("File type must be provided if file source is a byte string.")
        else:
            file_type != "pdf" and validate_media_type(media_type, file_type)
        file_data = file_source
    else:
        file_path = Path(file_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.")

        file_type = file_type or file_path.suffix[1:].lower()
        if file_path.suffix.lower() != f".{file_type}":
            raise ValueError(f"Provided file is not a {file_type.upper()}.")

        file_type != "pdf" and validate_media_type(media_type, file_type)

        file_data = file_path.read_bytes()

    if len(file_data) > 5_000_000:
        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."
        )

    return file_data, file_type

    Utility function to check the input file and get the file data as bytes.

    Args:
        file_source: The path to the media file or a non-b64 encoded byte string.
        file_type: The type of the video file. If not provided, it will be inferred from the file extension.
        media_type: Type of media ('video', 'audio', or 'image').

    Returns:
        File data as bytes.

    Raises:
        FileNotFoundError: If the file does not exist or is empty.
        ValueError: If no provided file type using bytes as input, the file type does not match the expected extension or the file size is too large (>5MB).
    
argilla-v1/src/argilla_v1/client/feedback/utils/html_utils.py