def dict_to_casl_rules(rules: dict):
    """
    Given a dict where the keys are the subject and the values are the actions, return
    a list of dicts ready to be serialized as JSON

    :return:
    """
    perms = []
    for key, actions in rules.items():
        perms.append({
            'subject': key,
            'actions': actions
        })
    return perms