def _strip_mongodb_id(x):
    """
    Rename the ``_id`` key from a dict as ``id``, if the latter doesn't already
    exist. If that's the case, remove the key.
    Update the object in-place.
    """
    if "_id" in x:
        if "id" not in x:
            x["id"] = x.pop("_id")
        else:
            del x["_id"]
    return x