You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: router_rbac_rule_region.go
    path of file: ./repos/cds/engine/api
    
    the code of the file until where you have to start completion: package api

import (
	"context"

	"github.com/go-gorp/gorp"

	"github.com/ovh/cds/engine/api/organization"
	"github.com/ovh/cds/engine/api/rbac"
	"github.com/ovh/cds/engine/api/region"
	"github.com/ovh/cds/engine/cache"
	"github.com/ovh/cds/sdk"
	cdslog "github.com/ovh/cds/sdk/log"
	"github.com/ovh/cds/sdk/telemetry"
)

func hasRoleOnRegion(ctx context.Context, auth *sdk.AuthUserConsumer, store cache.Store, db gorp.SqlExecutor, regionIdentifier string, role strin
    
func hasRoleOnRegionAndUserID(ctx context.Context, db gorp.SqlExecutor, role string, authentifiedUser *sdk.AuthentifiedUser, regionIdentifier string) (bool, error) {
	ctx, next := telemetry.Span(ctx, "rbac.HasRoleOnRegionAndUserID")
	defer next()

	// Get all region permissions with the given user
	rRegion, err := rbac.LoadRegionIDsByRoleAndUserID(ctx, db, role, authentifiedUser.ID)
	if err != nil {
		return false, err
	}

	// Load user organization to get its ID
	org, err := organization.LoadOrganizationByName(ctx, db, authentifiedUser.Organization)
	if err != nil {
		return false, err
	}

	// Load region ID if needed
	regionID := regionIdentifier
	if !sdk.IsValidUUID(regionID) {
		reg, err := region.LoadRegionByName(ctx, db, regionIdentifier)
		if err != nil {
			return false, err
		}
		regionID = reg.ID
	}

	// Check region and organization
	for _, rr := range rRegion {
		if rr.RegionID == regionID {
			if err := rbac.LoadRBACRegionOrganizations(ctx, db, &rr); err != nil {
				return false, err
			}
			for _, rbacOrga := range rr.RBACOrganizationIDs {
				if rbacOrga == org.ID {
					return true, nil
				}
			}
		}
	}
	return false, nil
}