def LevenshteinCost(a, b):
  """Cost function for Levenshtein distance with substitutions.

  Cost function for what is now thought of as the classical
  Levenshtein distance, which is the minimum number of insertions,
  deletions, and substitutions required to edit one sequence into
  another.  Returns zero for matches, unity for indels and
  substitutions.

  Args:
      a: input symbol, or None for insertions
      b: output symbol, or None for deletions

  Returns:
      0 for exact match
      1 for mismatch / substitution
      1 for insertion or deletion
  """
  if a == b:
    return 0
  else:
    return 1