def validate_policy(policy):
    """
    Simple validation a policy include som necessary elements.
    """
    if 'name' not in policy:
        raise AttributeError('Policy missing attribute name.')
    if 'policyType' not in policy:
        raise AttributeError('Policy {} do not have PolicyType.'.format(
            policy['name']))
    if policy['policyType'] not in [0, 1, 2]:
        raise AttributeError('Policy {} must have PolicyType 0, 1, or 2.'.
            format(policy['name']))
    if 'resources' not in policy:
        raise AttributeError('Policy {} do not have resources.'.format(
            policy['name']))
    if policy['policyType'] == 0 and not ('policyItems' in policy or 
        'denyPolicyItems' in policy):
        raise AttributeError(
            'Policy {} do not have policyItems nor denyPolicyItems.'.format
            (policy['name']))
