'Changes the primary or default name of a policy. The new primary
name can be an alias that already belongs to the policy or a
completely new name.
:param policy_index: index of a policy in this policy collection.
:param new_name: a string name to set as the new default name.'

def change_policy_primary_name(self, policy_index, new_name):

    policy = self.get_by_index(policy_index)
    name_taken = self.get_by_name(new_name)
    if (name_taken and (name_taken != policy)):
        raise PolicyError(('Other    policy    %s    with    name    %s    exists.' % (self.get_by_name(new_name).idx, new_name)))
    else:
        policy.change_primary_name(new_name)
        self.by_name[new_name.upper()] = policy
