code: def revoke_local_roles_for(brain_or_object, roles, user=None):
      
      user_id = get_user_id(user)
      obj = api.get_object(brain_or_object)
      valid_roles = get_valid_roles_for(obj)
      to_grant = list(get_local_roles_for(obj))
  
      if isinstance(roles, basestring):
          roles = [roles]
  
      for role in roles:
          if role in to_grant:
              if role not in valid_roles:
                  raise ValueError("The Role '{}' is invalid.".format(role))
              # Remove the role
              to_grant.remove(role)
  
      if len(to_grant) > 0:
          obj.manage_setLocalRoles(user_id, to_grant)
      else:
          obj.manage_delLocalRoles([user_id])
      return get_local_roles_for(brain_or_object)
docs: Revoke local roles for the object
  
      Code extracted from `IRoleManager.manage_setLocalRoles`
  
      :param brain_or_object: Catalog brain or object
      :param roles: The local roles to revoke for the current user
      :param user: A user ID, user object or None (for the current user)