def get_process_permissions(policy, process, files_dict):
    """Get the permissions a given process has on the given files.

    Returns a dictionary (filename, set(perms))."""
    file_permissions = {}
    accessible_types = policy.get_types_accessible_by(process.context)
    for fname, f in files_dict.iteritems():
        # TODO: expand matching to full context?
        if f.context.type in accessible_types:
            # We have some rule to this target type
            for rule in accessible_types[f.context.type]:
                if f.security_class == rule.tclass:
                    # We have some rule applicable to this file class
                    if file_permissions in fname:
                        file_permissions[fname].update(rule.perms)
                    else:
                        file_permissions[fname] = rule.perms
    return file_permissions
dataset/ETHPy150Open seandroid-analytics/seal/seal.py/get_process_permissions/swapped operands of `in`