def _getlatest_ami_id(context):
  """
  Get the most recent AMI ID for a service
  Args:
    context: a populated EFVersionContext object
  Returns:
    ImageId or None if no images exist or on error
  """
  try:
    response = context.aws_client("ec2").describe_images(
        Filters=[
            {"Name": "is-public", "Values": ["false"]},
            {"Name": "name", "Values": [context.service_name + EFConfig.AMI_SUFFIX + "*"]}
        ])
  except:
    return None
  if len(response["Images"]) > 0:
    return sorted(response["Images"], key=itemgetter('CreationDate'), reverse=True)[0]["ImageId"]
  else:
    return None
def _getlatest_ami_id ( context ) : try : response = context . aws_client ( "ec2" ) . describe_images ( Filters = [ { "Name" : "is-public" , "Values" : [ "false" ] } , { "Name" : "name" , "Values" : [ context . service_name + EFConfig . AMI_SUFFIX + "*" ] } ] ) except : return None if len ( response [ "Images" ] ) > 0 : return sorted ( response [ "Images" ] , key = itemgetter ( 'CreationDate' ) , reverse = True ) [ 0 ] [ "ImageId" ] else : return None
Get the most recent AMI ID for a service
  Args:
    context: a populated EFVersionContext object
  Returns:
    ImageId or None if no images exist or on error