def METHOD_NAME(cmd, namespace):
    from msrestazure.tools import resource_id, is_valid_resource_id
    from azure.cli.core.commands.client_factory import get_subscription_id
    # Different custom function arg names, instance pool has subnet_id
    is_instance_pool = False
    if hasattr(namespace, "subnet_id"):
        is_instance_pool = True
        subnet = namespace.subnet_id
    else:
        subnet = namespace.virtual_network_subnet_id
    subnet_is_id = is_valid_resource_id(subnet)
    vnet = namespace.vnet_name
    if (subnet_is_id and not vnet) or (not subnet and not vnet):
        pass
    elif subnet and not subnet_is_id and vnet:
        virtual_network_subnet_id = resource_id(
            subscription=get_subscription_id(cmd.cli_ctx),
            resource_group=namespace.resource_group_name,
            namespace='Microsoft.Network',
            type='virtualNetworks',
            name=vnet,
            child_type_1='subnets',
            child_name_1=subnet)
        if is_instance_pool:
            namespace.subnet_id = virtual_network_subnet_id
        else:
            namespace.virtual_network_subnet_id = virtual_network_subnet_id
    else:
        raise CLIError('incorrect usage: [--subnet ID | --subnet NAME --vnet-name NAME]')
    delattr(namespace, 'vnet_name')