def is_dementia(code):
    """
    ICD9
        294.10, 294.11 , 294.20, 294.21
        290.-   (all codes and variants in 290.- tree)
    ICD10
        F01.- All codes and their variants in this trees
        F02.- All codes and their variants in this trees
        F03.- All codes and their variants in this trees
    :param code: code string to test
    :return:  true or false
    """
    assert isinstance(code, str)
    code_set = ('294.10', '294.11', '294.20', '294.21', '2941', '29411', '2942', '29421')
    code_set += ('290',)
    code_set += ('F01', 'F02', 'F03')
    return code.startswith(code_set)