def METHOD_NAME(params):
    client = hashivault_auth_client(params)
    entity_name = params.get('name')
    entity_id = params.get('id')
    entity_metadata = params.get('metadata')
    entity_disabled = params.get('disabled')
    entity_policies = params.get('policies')
    if entity_id is not None:
        try:
            entity_details = client.secrets.identity.read_entity(entity_id=entity_id)
        except Exception as e:
            return {'failed': True, 'msg': str(e)}
        return hashivault_identity_entity_update(entity_details['data'], client, entity_name, entity_id,
                                                 entity_metadata, entity_disabled, entity_policies)
    elif entity_name is not None:
        try:
            entity_details = client.secrets.identity.read_entity_by_name(name=entity_name)
        except Exception:
            response = client.secrets.identity.create_or_update_entity_by_name(
                name=entity_name,
                metadata=entity_metadata,
                policies=entity_policies,
                disabled=entity_disabled
            )
            return {'changed': True, 'data': response['data']}
        return hashivault_identity_entity_update(entity_details['data'], client, entity_name=entity_name,
                                                 entity_id=entity_details['data']['id'],
                                                 entity_metadata=entity_metadata,
                                                 entity_disabled=entity_disabled, entity_policies=entity_policies)
    return {'failed': True, 'msg': "Either name or id must be provided"}