from typing import Tuple


def rgba_to_html_string(rgba: Tuple[int, int, int, float]) -> str:
    """Create an HTML code from an RGBA tuple

    Parameters
    ----------
    rgba : Tuple[int, int, int, float] | Tuple[int, int, int]
        RGB values and an optional alpha value between 0 and 1.

    Returns
    -------
    str

    Raises
    ------
    ValueError
        If the color tuple is not either RGB or RGBA
    """
    if len(rgba) == 4:
        return f"rgba({rgba[0]}, {rgba[1]}, {rgba[2]}, {rgba[3]:.3f})"
    elif len(rgba) == 3:
        return f"rgb({rgba[0]}, {rgba[1]}, {rgba[2]})"
    else:
        raise ValueError("You did not pass a valid color tuple")