The default category when making a query

def default_value(self):
        """ The default category when making a query
        """
        if not hasattr(self, "_default_value"):
            if self.elem_type == "select":
                try:
                    # Get option marked "selected"
                    def_value = get_option_value(self.elem.select_one("[selected]"))
                except AttributeError:
                    # ...or if that one doesen't exist get the first option
                    def_value = get_option_value(self.elem.select_one("option"))

            elif self.elem_type == "checkbox":
                def_value = self.elem.get("value")

            elif self.elem_type == "radio":
                def_value = [x for x in self.elem if x.has_attr("checked")][0].get("value")

            self._default_value = def_value

            assert def_value is not None

        return self._default_value