<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate(policy):
 """ Validates a policy and its parameters and raises an error if invalid """

    for param, value in policy.items():

        if param not in ACCEPTED_SECURITY_TYPES.keys():
            raise SecurityError('Invalid Security Parameter: {}'.format(param))

        if type(value) != ACCEPTED_SECURITY_TYPES[param]:
            raise SecurityError('Invalid Parameter Data Type for {}, '
                                'Expecting: {} Received: {}'.format(
                                    param, ACCEPTED_SECURITY_TYPES[param],
                                    type(value)))