<commit_before># Helpers (also imported locally and used in other modules)
function Resolve-SafeguardPlatform
{
    Param(
        [Parameter(Mandatory=$false)]
        [string]$Appliance,
        [Parameter(Mandatory=$false)]
        [object]$AccessToken,
        [Parameter(Mandatory=$false)]
        [switch]$Insecure,
        [Parameter(Mandatory=$true,Position=0)]
        [object]$Platform
    )

    $ErrorActionPreference = "Stop"
    if (-not $PSBoundParameters.ContainsKey("Verbose")) { $VerbosePreference = $PSCmdlet.GetVariableValue("VerbosePreference") }

    while (-not $($Platform -as [int]))
    {
        Write-Host "Searching for platforms with '$Platform'"
        $local:Platforms = (Invoke-SafeguardMethod -AccessToken $AccessToken -Appliance $Appliance -Insecure:$Insecure Core GET Platforms `
                                                   -Parameters @{ Filter = "DisplayName icontains '$Platform'" })
        if (-not $local:Platforms)
        {
            $local:Platforms = (Find-SafeguardPlatform -AccessToken $AccessToken -Appliance $Appliance -Insecure:$Insecure "$Platform")
        }
        if (-not $local:Platforms)
        {
            throw "Unable to find platform matching '$Platform'..."
        }
        if ($local:Platforms.Count -ne 1)
        {
            Write-Host "Found $($local:Platforms.Count) platforms matching '$Platform':"
            Write-Host "["
            $local:Platforms | ForEach-Object {
                Write-Host ("    {0,3} - {1}" -f $_.Id,$_.DisplayName)
            }
            Write-Host "]"
            $Platform = (Read-Host "Enter platform ID or search string")
        }
        else
        {
            $Platform = $local:Platforms[0].Id
        }
    }
    $Platform
}
function Resolve-SafeguardServiceAccountCredentialType
{
    $ErrorActionPreference = "Stop"
    if (-not $PSBoundParameters.ContainsKey("Verbose")) { $VerbosePreference = $PSCmdlet.GetVariableValue("VerbosePreference") }
<commit_msg>Added a fallback for icontains as well<commit_after># Helpers (also imported locally and used in other modules)
function Resolve-SafeguardPlatform
{
    Param(
        [Parameter(Mandatory=$false)]
        [string]$Appliance,
        [Parameter(Mandatory=$false)]
        [object]$AccessToken,
        [Parameter(Mandatory=$false)]
        [switch]$Insecure,
        [Parameter(Mandatory=$true,Position=0)]
        [object]$Platform
    )

    $ErrorActionPreference = "Stop"
    if (-not $PSBoundParameters.ContainsKey("Verbose")) { $VerbosePreference = $PSCmdlet.GetVariableValue("VerbosePreference") }

    while (-not $($Platform -as [int]))
    {
        Write-Host "Searching for platforms with '$Platform'"
        try
        {
            $local:Platforms = (Invoke-SafeguardMethod -AccessToken $AccessToken -Appliance $Appliance -Insecure:$Insecure Core GET Platforms `
                                    -Parameters @{ Filter = "DisplayName icontains '$Platform'" })
        }
        catch
        {
            Write-Verbose $_
            Write-Verbose "Caught exception with icontains filter, trying with contains filter"
            $local:Platforms = (Invoke-SafeguardMethod -AccessToken $AccessToken -Appliance $Appliance -Insecure:$Insecure Core GET Platforms `
                                    -Parameters @{ Filter = "DisplayName contains '$Platform'" })
        }
        if (-not $local:Platforms)
        {
            $local:Platforms = (Find-SafeguardPlatform -AccessToken $AccessToken -Appliance $Appliance -Insecure:$Insecure "$Platform")
        }
        if (-not $local:Platforms)
        {
            throw "Unable to find platform matching '$Platform'..."
        }
        if ($local:Platforms.Count -ne 1)
        {
            Write-Host "Found $($local:Platforms.Count) platforms matching '$Platform':"
            Write-Host "["
            $local:Platforms | ForEach-Object {
                Write-Host ("    {0,3} - {1}" -f $_.Id,$_.DisplayName)
            }
            Write-Host "]"
            $Platform = (Read-Host "Enter platform ID or search string")
        }
        else
        {
            $Platform = $local:Platforms[0].Id
        }
    }
    $Platform
}
function Resolve-SafeguardServiceAccountCredentialType
{
    $ErrorActionPreference = "Stop"
    if (-not $PSBoundParameters.ContainsKey("Verbose")) { $VerbosePreference = $PSCmdlet.GetVariableValue("VerbosePreference") }

{'fraction_non_alphanumeric': 0.12006319115323855, 'fraction_numerical': 0.002708192281651997, 'mean_word_length': 2.3198501872659176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1956213', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1209, 'n_words': 264}