(rcpts, items, analyst, update=False)
return changes
Given the list of items being sent to a list of recipients via TAXII,
    determine what releasability changes (if any) are necessary for the
    TAXII message to be sent.

    :param rcpts List of sources to which all items in ITEMS must be releasable
    :param items List of items to ensure have proper releasability within RCPTS
    :param analyst Name of the analyst triggering the releasability update
    :param update If true, execute the changes
    :return Dict mapping item to list of necessary releasability additions
Given the list of items being sent to a list of recipients via TAXII,
    determine what releasability changes (if any) are necessary for the
    TAXII message to be sent.
Given the list of items being sent to a list of recipients via TAXII determine what releasability changes ( if any ) are necessary for the TAXII message to be sent .
def verify_releasability(rcpts, items, analyst, update=False):
    """
    Given the list of items being sent to a list of recipients via TAXII,
    determine what releasability changes (if any) are necessary for the
    TAXII message to be sent.

    :param rcpts List of sources to which all items in ITEMS must be releasable
    :param items List of items to ensure have proper releasability within RCPTS
    :param analyst Name of the analyst triggering the releasability update
    :param update If true, execute the changes
    :return Dict mapping item to list of necessary releasability additions
    """
    date = datetime.now() # timestamp to use for updates, if updating
    releaseable = Releasability.ReleaseInstance(analyst=analyst, date=date)
    changes = []
    for item in items: # for each item
        updates = [] # track sources that need releasability update
        curr_rel = [rel.name for rel in item['releasability']] # current item releasability
        for rcpt in rcpts: # check each source
            if not rcpt in curr_rel: # if ITEM is not releasable to source RCPT
                updates.append(rcpt) # note necessary releasability update
                if update: # if processing updates, add releasability to item
                    item.add_releasability(name=rcpt, instances=[releaseable],
                                           analyst=analyst)
            elif update: # if updating and already releasable, add a release instance
                item.add_releasability_instance(name=rcpt, instance=releaseable,
                                                analyst=analyst)
        if update:
            # if updating, the item will always be changed, so save it
            item.save(username=analyst)
        if updates:
            item_type = item._meta['crits_type']
            formatted = formats.get_format(item_type).format(item)
            changes.append((item_type, str(item.id), formatted, updates))
    return changes
def verify_releasability ( rcpts , items , analyst , update = False ) : date = datetime . now ( ) # timestamp to use for updates, if updating releaseable = Releasability . ReleaseInstance ( analyst = analyst , date = date ) changes = [ ] for item in items : # for each item updates = [ ] # track sources that need releasability update curr_rel = [ rel . name for rel in item [ 'releasability' ] ] # current item releasability for rcpt in rcpts : # check each source if not rcpt in curr_rel : # if ITEM is not releasable to source RCPT updates . append ( rcpt ) # note necessary releasability update if update : # if processing updates, add releasability to item item . add_releasability ( name = rcpt , instances = [ releaseable ] , analyst = analyst ) elif update : # if updating and already releasable, add a release instance item . add_releasability_instance ( name = rcpt , instance = releaseable , analyst = analyst ) if update : # if updating, the item will always be changed, so save it item . save ( username = analyst ) if updates : item_type = item . _meta [ 'crits_type' ] formatted = formats . get_format ( item_type ) . format ( item ) changes . append ( ( item_type , str ( item . id ) , formatted , updates ) ) return changes