def log_rate_limits(target, resp, level=20):
 rate_limits = resp['rateLimits']
 resetsAt = dt_util.parse_datetime(rate_limits['resetsAt'])
 resetsAtTime = (resetsAt - datetime.now(timezone.utc))
 rate_limit_msg = 'iOS push notification rate limits for %s: %d sent, %d allowed, %d errors, resets in %s'
 _LOGGER.log(level, rate_limit_msg, ios.device_name_for_push_id(target), rate_limits['successful'], rate_limits['maximum'], rate_limits['errors'], str(resetsAtTime).split('.')[0])

def log_rate_limits ( target , resp , level = 20 ) : rate_limits = resp [ 'rateLimits' ] resetsAt = dt_util . parse_datetime ( rate_limits [ 'resetsAt' ] ) resetsAtTime = ( resetsAt - datetime . now ( timezone . utc ) ) rate_limit_msg = 'iOS push notification rate limits for %s: %d sent, %d allowed, %d errors, resets in %s' _LOGGER . log ( level , rate_limit_msg , ios . device_name_for_push_id ( target ) , rate_limits [ 'successful' ] , rate_limits [ 'maximum' ] , rate_limits [ 'errors' ] , str ( resetsAtTime ) . split ( '.' ) [ 0 ] )
output rate limit log line at given level .