def FindLatestProfile(target, versions):
  """Find latest profile that is usable by the target.

  Args:
    target: the target version
    versions: a list of versions, and should be sorted

  Returns:
    latest profile that is older than the target
  """
  candidates = [x for x in versions if tuple(x) < tuple(target)]
  if len(candidates) == 0:
    return None
  return candidates[-1]