def is_valid(line):
    """
    Returns true if a line inside a configuration file is a valid theme configuration pair: is not a comment, is not
    empty and the key is correct.

    :param line: a line inside the configuration file
    :type line: str
    :return: true if is valid, false otherwise
    :rtype: bool
    """
    return (not line.lstrip().startswith("#")  # is not a comment
            and len(line.strip()) != 0  # is not empty
            and line.split(maxsplit=1)[0] in theme_keys)  # key is a valid one

    Returns true if a line inside a configuration file is a valid theme configuration pair: is not a comment, is not
    empty and the key is correct.

    :param line: a line inside the configuration file
    :type line: str
    :return: true if is valid, false otherwise
    :rtype: bool
    
.tools/preview.py