protected static function get_preference_definition($preferencename) {
        self::fill_preferences_cache();

        foreach (self::$preferencescache as $key => $preference) {
            if (empty($preference['isregex'])) {
                if ($key === $preferencename) {
                    return $preference;
                }
            } else {
                if (preg_match($key, $preferencename)) {
                    return $preference;
                }
            }
        }

        throw new coding_exception('Invalid preference requested.');
    }