def METHOD_NAME(rgb) -> [str, float]:
    """
    This function converts rgb or rgba-formatted color code to an hexadecimal code.
    Alpha channel from RGBA color codes is passed without any conversion
    as a second return variable and is completely ignored in hexadecimal codes
    to remain compliant with web stantards.
    """
    if rgb.startswith("rgb"):
        rgb_values = rgb.strip("rgb()")
    if rgb.startswith("rgba"):
        rgb_values = rgb.strip("rgba()")
    rgb_list = rgb_values.split(",")
    red = int(rgb_list[0])
    green = int(rgb_list[1])
    blue = int(rgb_list[2])
    alpha = None
    if len(rgb_list) == 4:
        alpha = float(rgb_list[3])
    hex_out = [f"{red:x}", f"{green:x}", f"{blue:x}"]
    for i, hex_part in enumerate(hex_out):
        if len(hex_part) == 1:
            hex_out[i] = "0" + hex_part
    return "#" + "".join(hex_out), alpha