def rate(r):
 if r:
  if isinstance(r, string_t):
   (ops, _, modifier) = r.partition(u'/')
   return (RATE_MODIFIER_MAP[(modifier or u's')](float(ops)) or 0)
  return (r or 0)
 return 0

def rate ( r ) : if r : if isinstance ( r , string_t ) : ( ops , _ , modifier ) = r . partition ( u'/' ) return ( RATE_MODIFIER_MAP [ ( modifier or u's' ) ] ( float ( ops ) ) or 0 ) return ( r or 0 ) return 0
convert rate string to seconds .