def delete(api, model, obj, ident=None, name=None):
    """delete

    Calls api object delete function in order to delete an object.
    The selection is based on id or name of the object.

    :param api: Api object
    :param model: string, tells which data model to use
    :param obj: string tells which object to use
    :param ident: int, numerical identifier of the object
    :param name: string, name of the object
    """
    if (ident is None) and name is not None:
        ident = api.get_id_by_name("{}/{}".format(
            model, obj), name
        )
    res = api.delete(
        path="{}/{}/{}".format(model, obj, ident)
    )
    # Response.json() raises an exception when there is no data,
    # and it seems normal: https://github.com/requests/requests/issues/4186
    result = None
    try:
        result = res.json()
    except ValueError:
        result = res.text
    return result