def get_rotation(rotation):
 try:
  angle = float(rotation)
 except (ValueError, TypeError):
  isString = isinstance(rotation, six.string_types)
  if ((isString and (rotation == u'horizontal')) or (rotation is None)):
   angle = 0.0
  elif (isString and (rotation == u'vertical')):
   angle = 90.0
  else:
   raise ValueError(u"rotation is {0} expected either 'horizontal' 'vertical', numeric value orNone".format(rotation))
 return (angle % 360)

def get_rotation ( rotation ) : try : angle = float ( rotation ) except ( ValueError , TypeError ) : isString = isinstance ( rotation , six . string_types ) if ( ( isString and ( rotation == u'horizontal' ) ) or ( rotation is None ) ) : angle = 0.0 elif ( isString and ( rotation == u'vertical' ) ) : angle = 90.0 else : raise ValueError ( u"rotation is {0} expected either 'horizontal' 'vertical', numeric value orNone" . format ( rotation ) ) return ( angle % 360 )
return the text angle as float .