Python Plugin for IP Rate Limiting

Thanks for the help. We moved on to using the Auth Middlewear for the python rate limiter. We currently have this snippet:
session.rate = 10.0 session.per = 5.0 session.apply_policy_id = "58ed16c2d81dd63719640c19" metadata['token'] = request.get_header('X-Real-Ip')

Our problem is that the apply_policy_id section doesn’t load in the policy that we want. Otherwise, the rate and per do rate limit correctly based on the metadata['token']

Are we missing anything in terms of applying policies through the session object?