docs: def analyze(anchore_config, force, image, imagefile, include_allanchore, dockerfile, imagetype, skipgates, layerstrategy, excludefile):
      """
      Invokes the anchore analyzer on the specified image(s).
  
      To include multiple images use the --imagefile, no option, or --include-allanchore options.
      To exclude specific images from analysis, use the --excludefile option.
  
      One of --imagetype or --dockerfile should be supplied for an analysis run. Use --dockerfile whenever possible as the inclusion
      of the dockerfile for an image associates the dockerfile and image for later use in queries etc. The --dockerfile option
      is only valid in combination with the --image option.  If neither --dockerfile and --imagetype is supplied, then 
  
      When using --imagetype, use 'none' to specify that the image(s) is an unknown or user image and use 'base' to specify
      that the image(s) are approved base images to be used to build other images or it is useful to mark the image one from which
      other images are meant to be derived.
  
      Image IDs can be specified as hash ids, repo names (e.g. centos), or tags (e.g. centos:latest).
  
      """
  
      success = True
      ecode = 0
  
      args = {}
  
      if image and imagefile:
          raise click.BadOptionUsage('Can only use one of --image, --imagefile')
  
      if dockerfile and not image:
          raise click.BadOptionUsage('Must specify --image option when using --dockerfile option')
  
      if not imagefile:
          if imagetype:
              if imagetype == "anchorebase":
                  args['anchorebase'] = True
              elif imagetype == "base":
                  args['isbase'] = True
              elif imagetype == "none":
                  pass
              else:
                  raise click.BadOptionUsage("Invalid imagetype specified: valid types are 'none' or 'base'")
  
      try:
          imagedict = build_image_list(anchore_config, image, imagefile, not (image or imagefile), include_allanchore, exclude_file=excludefile, dockerfile=dockerfile)
          imagelist = imagedict.keys()
  
          try:
              ret = anchore_utils.discover_imageIds(imagelist)
          except ValueError as err:
              raise err
          else:
              #imagelist = ret.keys()
              imagelist = ret
  
      except Exception as err:
          anchore_print_err("could not load any images")
          ecode = 1
      else:
  
          step = 1
          count = 0
          allimages = {}
          success = True
          for imageId in imagedict.keys():
  
              if count % step == 0:
                  allimages.clear()
                  allimages = {}
                  count = 0
  
              args.update({'dockerfile': imagedict[imageId]['dockerfile'], 'skipgates': skipgates, 'selection_strategy': layerstrategy})
  
              inlist = [imageId]
              try:
                  anchore_print("Analyzing image: " + imageId)
                  rc = analyzer.Analyzer(anchore_config=anchore_config, imagelist=inlist, allimages=allimages, force=force, args=args).run()
                  if not rc:
                      anchore_print_err("analysis failed.")
                      success = False
                      ecode = 1
  
              except:
                  anchore_print_err('failed to run analyzer')
                  allimages.clear()
                  success = False
                  ecode = 1
                  break
  
              count = count + 1
  
          allimages.clear()
  
          if not success:
              anchore_print_err("analysis failed for one or more images.")
              ecode = 1
  
      sys.exit(ecode)