Returns the first value for a key.

        If `type` is not None, the value will be converted by calling
        `type` with the value as argument. If type() raises `ValueError`, it
        will be treated as if the value didn't exist, and `default` will be
        returned instead.

def get(self, key, default=None, type=None):
        """Returns the first value for a key.

        If `type` is not None, the value will be converted by calling
        `type` with the value as argument. If type() raises `ValueError`, it
        will be treated as if the value didn't exist, and `default` will be
        returned instead.
        """
        try:
            value = self[key]
            if type is not None:
                return type(value)
            return value
        except (KeyError, ValueError):
            return default