<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_enumerated_image_sizes(spec, feature_name, sizes):
 """ Annotate an input or output image feature in a Neural Network spec to to accommodate a list of enumerated image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the image feature for which to add size information. If the feature is not found in the input or output descriptions then an exception is thrown :param sizes: [] | NeuralNetworkImageSize A single or a list of NeuralNetworkImageSize objects which encode valid size information for a image feature Examples -------- .. sourcecode:: python :return: None. The spec object is updated """

    if not isinstance(sizes, list):
        sizes = [sizes]

    for size in sizes:
        if not isinstance(size, NeuralNetworkImageSize):
            raise Exception(
                'Shape ranges should be of type NeuralNetworkImageSize')

    feature = _get_feature(spec, feature_name)
    if feature.type.WhichOneof('Type') != 'imageType':
        raise Exception('Trying to add enumerated sizes to '
                        'a non-image feature type')

    if feature.type.imageType.WhichOneof(
            'SizeFlexibility') != 'enumeratedSizes':
        feature.type.imageType.ClearField('SizeFlexibility')

    esizes_len = len(feature.type.imageType.enumeratedSizes.sizes)

    # Add default image size to list of enumerated sizes if enumerated sizes
    # field is currently empty
    if esizes_len == 0:
        fixed_height = feature.type.imageType.height
        fixed_width = feature.type.imageType.width
        sizes.append(NeuralNetworkImageSize(fixed_height, fixed_width))

    for size in sizes:
        s = feature.type.imageType.enumeratedSizes.sizes.add()
        s.height = size.height
        s.width = size.width

    # Bump up specification version
    spec.specificationVersion = max(_MINIMUM_FLEXIBLE_SHAPES_SPEC_VERSION,
                                    spec.specificationVersion)