':param policies: list of policies'

def _validate_policies(self, policies):

    for policy in policies:
        if (int(policy) in self.by_index):
            raise PolicyError(('Duplicate    index    %s    conflicts    with    %s' % (policy, self.get_by_index(int(policy)))))
        for name in policy.alias_list:
            if (name.upper() in self.by_name):
                raise PolicyError(('Duplicate    name    %s    conflicts    with    %s' % (policy, self.get_by_name(name))))
        if policy.is_default:
            if (not self.default):
                self.default = policy
            else:
                raise PolicyError(('Duplicate    default    %s    conflicts    with    %s' % (policy, self.default)))
        self._add_policy(policy)
    if (0 not in self.by_index):
        if (len(self) != 0):
            raise PolicyError('You    must    specify    a    storage    policy    section    for    policy    index    0    in    order    to    define    multiple    policies')
        self._add_policy(StoragePolicy(0, name=LEGACY_POLICY_NAME))
    enabled_policies = [p for p in self if (not p.is_deprecated)]
    if (not enabled_policies):
        raise PolicyError("Unable    to    find    policy    that's    not    deprecated!")
    if (not self.default):
        if (len(self) > 1):
            raise PolicyError('Unable    to    find    default    policy')
        self.default = self[0]
        self.default.is_default = True
