Hello,

Sorry but there is a errata in this piece:
u = kvm.users.get(id=userid)
for perm in u.permissions.list():
   udc = perm.get_data_center()
      if udc:
         globaldc = kvm.datacenters.get(id=udc.get_id())
         if globaldc.get_name() == dc:
            perm.delete()
The perm.delete() call is not correct and you need to put the following two lines:

   permission_service = permissions_service.permission_service(id=data_center_permission.id)
   permission_service.remove()

Of course you need:

     permissions_service = system_service.permissions_service()

Thanks and sorry for the errata
Manuel