def update_master_list(master_list, layer_obj):
    """Given a master list of package objects and a layer object containing a
    list of package objects, append to the master list all the package objects
    that are not in the master list and remove the duplicate packages from the
    layer object"""
    unique = []
    for _ in range(len(layer_obj.packages)):
        item = layer_obj.packages.pop(0)
        exists = False
        for pkg in master_list:
            if item.is_equal(pkg):
                exists = True
                break
        if not exists:
            unique.append(item)
    for u in unique:
        master_list.append(u)
    while unique:
        layer_obj.packages.append(unique.pop(0))
    del unique
