def do_provision(): provision_xmldoc_req = Provision.build("0", device_info) as_conn.set_policykey("0") provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse(provision_xmldoc_res) as_conn.set_policykey(policykey) storage.update_keyvalue("X-MS-PolicyKey", policykey) storage.update_keyvalue("EASPolicies", repr(policydict)) if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse(provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) storage.update_keyvalue("X-MS-PolicyKey", policykey)