Return the value of the highest matching substrings between two strings.

  Parameters
  ----------
    string1 : string
      First string.

    string2 : string
      Second string.

  Returns
  ----------
    int
      Integer value representing the best match found
      between string1 and string2.

def GetBestStringMatchValue(string1, string2):
  """
  Return the value of the highest matching substrings between two strings.

  Parameters
  ----------
    string1 : string
      First string.

    string2 : string
      Second string.

  Returns
  ----------
    int
      Integer value representing the best match found
      between string1 and string2.
  """
  # Ignore case
  string1 = string1.lower()
  string2 = string2.lower()

  # Ignore non-alphanumeric characters
  string1 = ''.join(i for i in string1 if i.isalnum())
  string2 = ''.join(i for i in string2 if i.isalnum())

  # Finding best match value between string1 and string2
  if len(string1) == 0 or len(string2) == 0:
    bestRatio = 0
  elif len(string1) == len(string2):
    match = difflib.SequenceMatcher(None, string1, string2)
    bestRatio = match.ratio()
  else:
    if len(string1) > len(string2):
      shortString = string2
      longString = string1
    else:
      shortString = string1
      longString = string2

    match = difflib.SequenceMatcher(None, shortString, longString)
    bestRatio = match.ratio()

    for block in match.get_matching_blocks():
      subString = longString[block[1]:block[1]+block[2]]
      subMatch = difflib.SequenceMatcher(None, shortString, subString)
      if(subMatch.ratio() > bestRatio):
        bestRatio = subMatch.ratio()

  return(bestRatio)