def sort_by_tag()

in functions/source/rotate_sealer_key_secret/lambda_function.py [0:0]


def sort_by_tag(version_tags):
  matches = [string for string in version_tags[1] if re.match('AWSPREVIOUS-CUSTOM_\d+', string)]
  if len(matches) > 0:
    custom_number = re.search('AWSPREVIOUS-CUSTOM_(\d+)', matches[0])
    return int(custom_number.group(1))+2
  elif "AWSCURRENT" in version_tags[1] or "AWSPENDING" in version_tags[1]:
    return 1
  elif "AWSPREVIOUS" in version_tags[1]:
    return 2
  else:
    return sys.maxsize