Convert a value stored in the database for a particular setting
        to its correct type, as determined by ``register_setting()``.

def _to_python(cls, setting, raw_value):
        """
        Convert a value stored in the database for a particular setting
        to its correct type, as determined by ``register_setting()``.
        """

        type_fn = cls.TYPE_FUNCTIONS.get(setting["type"], setting["type"])

        try:
            value = type_fn(raw_value)
        except ValueError:
            # Shouldn't occur, but just a safeguard in case
            # the db value somehow ended up as an invalid type.
            warn("The setting %s should be of type %s, but the value "
                 "retrieved from the database (%s) could not be converted. "
                 "Using the default instead: %s"
                 % (setting["name"], setting["type"].__name__,
                    repr(raw_value), repr(setting["default"])))
            value = setting["default"]

        return value