def delete(avatar, fullpath, on_behalf=None):
    """ Delete a container."""
    log.msg("Deleting a container %s" % fullpath)
    uid, vals = vcdm.env['ds'].find_by_path(fullpath, object_type='container',
                                            fields=['children',
                                                    'parent_container',
                                                    'metadata'])
    if uid is None:
        return NOT_FOUND
    else:
        # authorize call
        acls = vals['metadata'].get('cdmi_acl', None)
        if not authorize(avatar, fullpath, "delete_container", acls):
            log.err("Authorization failed.")
            return UNAUTHORIZED
        # fail if we are deleting a non-empty container
        if len(vals['children']) != 0:
            log.err("Cannot delete non-empty container %s. Existing children: %s."
                    % (fullpath, vals['children']))
            # we do not allow deleting non-empty containers
            return CONFLICT
        vcdm.env['ds'].delete(uid)
        if fullpath != '/':
            _remove_child(vals['parent_container'], uid)
        ## XXX: delete all children?
        log.msg(type='accounting', avatar=avatar if not on_behalf else on_behalf,
                amount=1, acc_type='container_delete')
        return NO_CONTENT

####### Support functions dealing with container logic #########
dataset/ETHPy150Open livenson/vcdm/src/vcdm/container.py/delete/original