code: def _check_perms_changes(name, newperms, runas=None, existing=None):
      '''
      Check whether Rabbitmq user's permissions need to be changed.
      '''
      if not newperms:
          return False
  
      if existing is None:
          try:
              existing = __salt__['rabbitmq.list_user_permissions'](name, runas=runas)
          except CommandExecutionError as err:
              log.error('Error: %s', err)
              return False
  
      perm_need_change = False
      for vhost_perms in newperms:
          for vhost, perms in six.iteritems(vhost_perms):
              if vhost in existing:
                  existing_vhost = existing[vhost]
                  if perms != existing_vhost:
                      # This checks for setting permissions to nothing in the state,
                      # when previous state runs have already set permissions to
                      # nothing. We don't want to report a change in this case.
                      if existing_vhost == '' and perms == ['', '', '']:
                          continue
                      perm_need_change = True
              else:
                  perm_need_change = True
  
      return perm_need_changf _check_perms_changes(name, newperms, runas=None, existing=None):
      '''
      Check whether Rabbitmq user's permissions need to be changed.
      '''
      if not newperms:
          return False
  
      if existing is None:
          try:
              existing = __salt__['rabbitmq.list_user_permissions'](name, runas=runas)
          except CommandExecutionError as err:
              log.error('Error: %s', err)
              return False
  
      perm_need_change = False
      for vhost_perms in newperms:
          for vhost, perms in six.iteritems(vhost_perms):
              if vhost in existing:
                  existing_vhost = existing[vhost]
                  if perms != existing_vhost:
                      # This checks for setting permissions to nothing in the state,
                      # when previous state runs have already set permissions to
                      # nothing. We don't want to report a change in this case.
                      if existing_vhost == '' and perms == ['', '', '']:
                          continue
                      perm_need_change = True
              else:
                  perm_need_change = True
  
      return perm_need_change
docs: Check whether Rabbitmq user's permissions need to be changed.