from typing import Dict
from typing import Any
from typing import Optional


def _process_api_resource(permission_resource: Dict[str, Any], api_operation: str) -> Optional[bool]:
    """Helper method to check if the api action permission is in this API resource
    Args:
        permission_resource: The dictionary for this permission resource to check
        api_operation: The api_operation as defined from is_key_allowed
    Returns:
        Value of the resource permission if it exists, else None
    """
    if api_operation == "create":
        return permission_resource.get("allow_create")
    elif api_operation == "read":
        return permission_resource.get("allow_read")
    elif api_operation == "update":
        return permission_resource.get("allow_update")
    elif api_operation == "delete":
        return permission_resource.get("allow_delete")
    else:
        raise RuntimeError(f"'{api_operation}' is not a valid api_operation (must be one of create, read, update, delete)")