code: def image_from_name(name, images):
      prefixed_images = [i for i in images if i.name.startswith(name)]
      if name in [i.name for i in prefixed_images]:
          return [i for i in prefixed_images if i.name == name][-1]
      decorated = sorted(
          [(int(re.search('\d+', i.name).group(0)), i) for i in prefixed_images])
      return [i[1] for i in decorated][-1]