def remove_by_identity(item_for_removal, a_list):
    """Remove item from list using an identity check.

    A ValueError is raised if the item isn't present.

    Parameters
    ==========
    item_for_removal (any value)
        item to be removed.
    a_list (list)
        list from where the item will be removed.
    """
    ### iterate over the list, keep tracking of the
    ### current index of the current item

    for index, item in enumerate(a_list):

        ## if the current item - is - the item for removal,
        ## pop it from the list using its index, then break
        ## out of the loop

        if item is item_for_removal:

            # changing the list while looping
            # it won't have adverse effects
            # because we break out of the loop
            # immediately after changing the list
            a_list.pop(index)
            break

    ### if the loop resumes normally, without we breaking
    ### out of it though, it means we didn't find the item
    ### for removal, so raise a ValueError to indicate it
    else:
        raise ValueError("'item_for_removal' not in list")
Remove item from list using an identity check.

    A ValueError is raised if the item isn't present.

    Parameters
    ==========
    item_for_removal (any value)
        item to be removed.
    a_list (list)
        list from where the item will be removed.
    
nodezator/ourstdlibs/behaviour.py