manually cherry-picking changes from lilv (python3) branch