def merge_color_and_opacity(color, opacity):
 if (color is None):
  return None
 rgb_tup = hex_to_rgb(color)
 if (opacity is None):
  return 'rgb {}'.format(rgb_tup)
 rgba_tup = (rgb_tup + (opacity,))
 return 'rgba {}'.format(rgba_tup)

def merge_color_and_opacity ( color , opacity ) : if ( color is None ) : return None rgb_tup = hex_to_rgb ( color ) if ( opacity is None ) : return 'rgb {}' . format ( rgb_tup ) rgba_tup = ( rgb_tup + ( opacity , ) ) return 'rgba {}' . format ( rgba_tup )
merge hex color with an alpha to get an rgba tuple .