def METHOD_NAME(self, key, empty, type):
    """Used internally by the accessor properties."""
    if type is bool:
        return key in self
    if key in self:
        value = self[key]
        if value is None:
            return empty
        elif type is not None:
            try:
                value = type(value)
            except ValueError:
                pass
        return value
    return None