def _policy_psets(policy_instances):
if len(policy_instances) == <NUM_LIT:0>:<EOL><INDENT>return PermissionSet.objects.filter(policyinstance__isnull=True)<EOL><DEDENT>else:<EOL><INDENT>return PermissionSet.objects.filter(<EOL>policyinstance__policy__in=policy_instances).distinct()<EOL><DEDENT>
Find all permission sets making use of all of a list of policy_instances.
    The input is an array of policy instances.