<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get(self, key: str, default=None, as_type: type = None, binary_file=False):
 """ Get a setting specified by key ``key``. Normally, settings are strings, but if you put non-strings into the settings object, you can request unserialization by specifying ``as_type``. If the key does not have a harcdoded default type, omitting ``as_type`` always will get you a string. If the setting with the specified name does not exist on this object, any parent object up to the global settings layer (if configured) will be queried. If still no value is found, a default value set in ths source code will be returned if one exists. If not, the value of the ``default`` argument of this method will be returned instead. If you receive a ``File`` object, it will already be opened. You can specify the ``binary_file`` flag to indicate that it should be opened in binary mode. """

        if as_type is None and key in self._h.defaults:
            as_type = self._h.defaults[key].type

        if key in self._cache():
            value = self._cache()[key]
        else:
            value = None
            if self._parent:
                value = getattr(self._parent, self._h.attribute_name).get(key, as_type=str)
            if value is None and key in self._h.defaults:
                value = self._h.defaults[key].value
            if value is None and default is not None:
                value = default

        return self._unserialize(value, as_type, binary_file=binary_file)