public static function get_key_prefix($name, $for_id = null)
    {

        // Ensure we have a prefix to work with.
        if (is_null(static::$prefix))
            throw new SettingException('No prefix defined. Have you extended and declared $prefix?');

        // Prefix user keys with group_id
        if (static::$scope != 'global')
            return implode('.', [$for_id, static::$prefix, $name]);

        // Global keys only with the global prefix.
        return implode('.', [static::$prefix, $name]);
    }