docs: def run(config, clear_opt=False):
      """Find an image and download it."""
      flickr = flickrapi.FlickrAPI(config.get('walls', 'api_key'),
                                   config.get('walls', 'api_secret'))
      width = config.getint('walls', 'width')
      height = config.getint('walls', 'height')
  
      # Clear out the destination dir
      if clear_opt:
          clear_dir(os.path.expanduser(config.get('walls', 'image_dir')))
  
      # Find an image
      tags = config.get('walls', 'tags')
      for photo in flickr.walk(tags=tags, format='etree'):
          try:
              photo_url = smallest_url(flickr, photo.get('id'), width, height)
              if photo_url:
                  break
          except (KeyError, ValueError, TypeError):
              stderr_and_exit('Unexpected data from Flickr.\n')
      else:
          stderr_and_exit('No matching photos found.\n')
  
      # Download the image
      dest = os.path.expanduser(config.get('walls', 'image_dir'))
      try:
          download(photo_url, dest)
      except IOError:
          stderr_and_exit('Error downloading image.\n')