def slice_config(config, key):
    """
    Slice config for printing as defined in key.

    :param ConfigManager config: configuration dictionary
    :param str key: dotted key, by which config should be sliced for printing

    :returns: sliced config
    :rtype: dict
    """
    if key:
        keys = key.split('.')
        for k in keys:
            config = config[k]
    return config
