def METHOD_NAME(img_size, crop_to_aspect_ratio):
    """Function to parse a TFRecord example into an image and label"""
    resizing = None
    if img_size:
        resizing = layers.Resizing(
            width=img_size[0],
            height=img_size[1],
            crop_to_aspect_ratio=crop_to_aspect_ratio,
        )
    def apply(example):
        # Read example
        image_key = "image/encoded"
        label_key = "image/class/label"
        keys_to_features = {
            image_key: tf.io.FixedLenFeature((), tf.string, ""),
            label_key: tf.io.FixedLenFeature([], tf.int64, -1),
        }
        parsed = tf.io.parse_single_example(example, keys_to_features)
        # Decode and resize image
        image_bytes = tf.reshape(parsed[image_key], shape=[])
        image = tf.io.decode_jpeg(image_bytes, channels=3)
        if resizing:
            image = resizing(image)
        # Decode label
        label = (
            tf.cast(tf.reshape(parsed[label_key], shape=()), dtype=tf.int32) - 1
        )
        label = tf.one_hot(label, 1000)
        return image, label
    return apply