def _IsValidComposerUpgrade(cur_version, candidate_version):
  """Validates that only MINOR and PATCH-level version increments are attempted.

  (For Composer upgrades)

  Checks that major-level remains the same, minor-level ramains same or higher,
  and patch-level is same or higher (if it's the only change)

  Args:
    cur_version: current 'a.b.c' Composer version
    candidate_version: candidate 'a.b.d' Composer version

  Returns:
    boolean value whether Composer candidate is valid
  """
  curr_parts = list(map(int, cur_version.split('.', 3)))
  cand_parts = list(map(int, candidate_version.split('.', 3)))

  if (curr_parts[0] == cand_parts[0] and
      (curr_parts[1] < cand_parts[1] or
       (curr_parts[1] <= cand_parts[1] and curr_parts[2] <= cand_parts[2]))):
    return True

  return False