from typing import List
from typing import Dict


def prepare_permission_object(permission_account_id: str, permission_group_name: str, attr: List) -> Dict:
    """
    Prepare permission object from the user provided values

    :type permission_account_id: ``str``
    :param permission_account_id: Account ID of the user to whom permission should be granted.

    :type permission_group_name: ``str``
    :param permission_group_name: Group name to whom permission should be granted.

    :type attr: ``List``
    :param attr: Operation and Target Type specified by user

    :rtype: ``Dict``
    :return: Returns permission object
    """
    permission_object = {
        "subjects": {
            "user": {
                "results": [
                    {
                        "accountId": permission_account_id
                    }
                ]
            },
            "group": {
                "results": [
                    {
                        "name": permission_group_name
                    }
                ]
            }
        },
        "operation": {
            "operation": attr[0],
            "targetType": attr[1]
        },
        "anonymousAccess": False,
        "unlicensedAccess": False
    }
    return permission_object