def update_privilege(self, privilege_id, name, version, statements):
self.clean_error()<EOL>try:<EOL><INDENT>url = self.get_url(Constants.UPDATE_PRIVILEGE_URL, privilege_id)<EOL>statement_data = []<EOL>for statement in statements:<EOL><INDENT>if isinstance(statement, Statement):<EOL><INDENT>statement_data.append({<EOL>'<STR_LIT>': statement.effect,<EOL>'<STR_LIT>': statement.actions,<EOL>'<STR_LIT>': statement.scopes<EOL>})<EOL><DEDENT>elif isinstance(statement, dict) and '<STR_LIT>' in statement and '<STR_LIT>' in statement and '<STR_LIT>' in statement:<EOL><INDENT>statement_data.append(statement)<EOL><DEDENT>else:<EOL><INDENT>self.error = str(<NUM_LIT>)<EOL>self.error_description = "<STR_LIT>"<EOL>return<EOL><DEDENT><DEDENT>privilege_data = {<EOL>'<STR_LIT:name>': name,<EOL>'<STR_LIT>': {<EOL>'<STR_LIT>': version,<EOL>'<STR_LIT>': statement_data,<EOL>}<EOL>}<EOL>response = self.execute_call('<STR_LIT>', url, json=privilege_data)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>json_data = response.json()<EOL>if json_data and '<STR_LIT:id>' in json_data:<EOL><INDENT>return Privilege(json_data['<STR_LIT:id>'], name, version, statements)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.error = str(response.status_code)<EOL>self.error_description = self.extract_error_message_from_response(response)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>self.error = <NUM_LIT><EOL>self.error_description = e.args[<NUM_LIT:0>]<EOL><DEDENT>
Updates a Privilege

:param privilege_id: The id of the privilege you want to update.
:type privilege_id: string

:param name: The name of the privilege.
:type name: string

:param version: The version for the privilege schema. Set to 2018-05-18.
:type version: string

:param statements: A list of statements. Statement object or a dict with the keys Effect, Action and Scope
:type statements: list[Statement] or list[dict]

Returns the modified privilege
:return: privilege
:rtype: Privilege

See https://developers.onelogin.com/api-docs/1/privileges/update-privilege Update Privilege documentation