def _rgba_tuple_to_kml_color_code(rgba):
    """
    Convert tuple of (red, green, blue, alpha) float values (0.0-1.0) to KML
    hex color code string "aabbggrr".
    """
    try:
        r, g, b, a = rgba
    except Exception:
        r, g, b = rgba
        a = 1.0
    return "".join(["%02x" % int(x * 255) for x in (a, b, g, r)])