def parse_rgb(args, alpha):
 types = [arg.type for arg in args]
 if (types == [u'INTEGER', u'INTEGER', u'INTEGER']):
  (r, g, b) = [(arg.value / 255) for arg in args[:3]]
  return RGBA(r, g, b, alpha)
 elif (types == [u'PERCENTAGE', u'PERCENTAGE', u'PERCENTAGE']):
  (r, g, b) = [(arg.value / 100) for arg in args[:3]]
  return RGBA(r, g, b, alpha)

def parse_rgb ( args , alpha ) : types = [ arg . type for arg in args ] if ( types == [ u'INTEGER' , u'INTEGER' , u'INTEGER' ] ) : ( r , g , b ) = [ ( arg . value / 255 ) for arg in args [ : 3 ] ] return RGBA ( r , g , b , alpha ) elif ( types == [ u'PERCENTAGE' , u'PERCENTAGE' , u'PERCENTAGE' ] ) : ( r , g , b ) = [ ( arg . value / 100 ) for arg in args [ : 3 ] ] return RGBA ( r , g , b , alpha )
if args is a list of 3 integer tokens or 3 percentage tokens .