def check_unique_attr(self, attrs, user=None, form=None, flash_msg=None):
        """Checks that an attribute of the current user is unique amongst all users.
        If no value is provided, the current form will be used.
        """
        user = user or self.current
        ucol = self.options["username_column"]
        email = self.options["email_column"]
        if not isinstance(attrs, (list, tuple, dict)):
            attrs = [attrs]

        for name in attrs:
            if isinstance(attrs, dict):
                value = attrs[name]
            else:
                form = form or current_context.data.get("form")
                if not form:
                    raise OptionMissingError("Missing 'value' option or form in 'check_user_unique_attr' action")
                value = form[name].data

            if name == ucol and not self.options["username_case_sensitive"]:
                filters = (ucol + '_lcase', value.strip().lower())
            elif name == emailcol:
                filters = (emailcol, value.strip().lower())
            else:
                filters = (name, value.strip())

            if self.query.filter({"$and": [filters, ("id__ne", user.id)]}).count() > 0:
                if flash_msg is None:
                    flash_msg = "The %s is already in use" % name
                if flash_msg:
                    flash(flash_msg, "error")
                current_context.exit(trigger_action_group="user_attr_not_unique")
Checks that an attribute of the current user is unique amongst all users.
        If no value is provided, the current form will be used.