docs: def get_mapping_actions(image=None, imageId=None, in_digests=[], bundle={}):
      """
      Given an image, image_id, digests, and a bundle, determine which policies and whitelists to evaluate.
      
      :param image: Image obj 
      :param imageId: image id string
      :param in_digests: candidate digests
      :param bundle: bundle dict to evaluate
      :return: tuple of (policy_data, whitelist_data, policy_name, whitelist_names, matchstring, mapping_rule_json obj, evalhash)
      """
  
      if not image or not bundle:
          raise Exception("input error")
  
      if not verify_policy_bundle(bundle=bundle):
          raise Exception("input bundle does not conform to bundle schema")
  
      ret = []
      
      image_infos = []
  
      image_info = anchore_utils.get_all_image_info(image)
      if image_info and image_info not in image_infos:
          image_infos.append(image_info)
  
      for m in bundle['mappings']:
          polname = m['policy_id']
          wlnames = m['whitelist_ids']
  
          for image_info in image_infos:
              #_logger.info("IMAGE INFO: " + str(image_info))
              ii = {}
              ii.update(image_info)
              registry = ii.pop('registry', "N/A")
              repo = ii.pop('repo', "N/A")
  
              tags = []
              fulltag = ii.pop('fulltag', "N/A")
              if fulltag != 'N/A':
                  tinfo = anchore_utils.parse_dockerimage_string(fulltag)
                  if 'tag' in tinfo and tinfo['tag']:
                      tag = tinfo['tag']
  
              for t in [image, fulltag]:
                  tinfo = anchore_utils.parse_dockerimage_string(t)
                  if 'tag' in tinfo and tinfo['tag'] and tinfo['tag'] not in tags:
                      tags.append(tinfo['tag'])
  
              digest = ii.pop('digest', "N/A")
              digests = [digest]
              for d in image_info['digests']:
                  dinfo = anchore_utils.parse_dockerimage_string(d)
                  if 'digest' in dinfo and dinfo['digest']:
                      digests.append(dinfo['digest'])
                                  
              p_ids = []
              p_names = []
              for p in bundle['policies']:
                  p_ids.append(p['id'])
                  p_names.append(p['name'])
  
              wl_ids = []
              wl_names = []
              for wl in bundle['whitelists']:
                  wl_ids.append(wl['id'])
                  wl_names.append(wl['name'])
                  
              if polname not in p_ids:
                  _logger.info("policy not in bundle: " + str(polname))
                  continue
  
              skip=False
              for wlname in wlnames:
                  if wlname not in wl_ids:
                      _logger.info("whitelist not in bundle" + str(wlname))
                      skip=True
              if skip:
                  continue
  
              mname = m['name']
              mregistry = m['registry']
              mrepo = m['repository']
              if m['image']['type'] == 'tag':
                  mtag = m['image']['value']
                  mdigest = None
                  mimageId = None
              elif m['image']['type'] == 'digest':
                  mdigest = m['image']['value']
                  mtag = None
                  mimageId = None
              elif m['image']['type'] == 'id':
                  mimageId = m['image']['value']
                  mtag = None
                  mdigest = None
              else:
                  mtag = mdigest = mimageId = None
  
              mregistry_rematch = mregistry
              mrepo_rematch = mrepo
              mtag_rematch = mtag
              try:
                  matchtoks = []
                  for tok in mregistry.split("*"):
                      matchtoks.append(re.escape(tok))
                  mregistry_rematch = "^" + '(.*)'.join(matchtoks) + "$"
  
                  matchtoks = []
                  for tok in mrepo.split("*"):
                      matchtoks.append(re.escape(tok))
                  mrepo_rematch = "^" + '(.*)'.join(matchtoks) + "$"
  
                  matchtoks = []
                  for tok in mtag.split("*"):
                      matchtoks.append(re.escape(tok))
                  mtag_rematch = "^" + '(.*)'.join(matchtoks) + "$"
              except Exception as err:
                  _logger.error("could not set up regular expression matches for mapping check - exception: " + str(err))
  
              _logger.debug("matchset: " + str([mregistry_rematch, mrepo_rematch, mtag_rematch]) + " : " + str([mregistry, mrepo, mtag]) + " : " + str([registry, repo, tag, tags]))
  
              if registry == mregistry or mregistry == '*' or re.match(mregistry_rematch, registry):
                  _logger.debug("checking mapping for image ("+str(image_info)+") match.")
  
                  if repo == mrepo or mrepo == '*' or re.match(mrepo_rematch, repo):
                      doit = False
                      matchstring = mname + ": N/A"
                      if tag:
                          if False and (mtag == tag or mtag == '*' or mtag in tags or re.match(mtag_rematch, tag)):
                              matchstring = mname + ":" + ','.join([mregistry, mrepo, mtag])
                              doit = True
                          else:
                              for t in tags:
                                  if re.match(mtag_rematch, t):
                                      matchstring = mname + ":" + ','.join([mregistry, mrepo, mtag])
                                      doit = True
                                      break
                      if not doit and (digest and (mdigest == digest or mdigest in in_digests or mdigest in digests)):
                          matchstring = mname + ":" + ','.join([mregistry, mrepo, mdigest])
                          doit = True
                      
                      if not doit and (imageId and (mimageId == imageId)):
                          matchstring = mname + ":" + ','.join([mregistry, mrepo, mimageId])
                          doit = True
  
                      matchstring = matchstring.encode('utf8')
                      if doit:
                          _logger.debug("match found for image ("+str(image_info)+") matchstring ("+str(matchstring)+")")
  
                          wldata = []
                          wldataset = set()
                          for wlname in wlnames:
                              wldataset = set(list(wldataset) + extract_whitelist_data(bundle, wlname))
                          wldata = list(wldataset)
  
                          poldata = extract_policy_data(bundle, polname)
                          
                          wlnames.sort()
                          evalstr = ','.join([polname] + wlnames)
                          evalhash = hashlib.md5(evalstr).hexdigest()
                          ret.append( ( poldata, wldata, polname,wlnames, matchstring, m, evalhash) )
                          return(ret)
                      else:
                          _logger.debug("no match found for image ("+str(image_info)+") match.")
                  else:
                      _logger.debug("no match found for image ("+str(image_info)+") match.")
  
      return(ret)