def get_permission_test(model, field, permission, instance=None):
    """
    Fetch a permission test for a field and permission.

    :param model: The model or instance
    :param field: Name of the field or None for instance/model-wide
    :param permission: Permission to check for
    """
    return getattr(model, '__jsonapi_permissions__', {})\
        .get(field, {})\
        .get(permission, lambda x: True)