def is_valid_xtb_solvent(gfn_version, solvent):
    """
    Check if solvent is valid for the given GFN version.

    Parameters
    ----------
    gfn_version : :class:`int`
        GFN parameterization version. Can be: ``0``, ``1`` or ``2``.

    solvent : :class:`str`
        Solvent being tested [1]_.

    Returns
    -------
    :class:`bool`
        ``True`` if solvent is valid.

    References
    ----------
    .. [1] https://xtb-docs.readthedocs.io/en/latest/gbsa.html

    """
    if gfn_version == 0:
        return False
    elif gfn_version == 1:
        valid_solvents = {'acetone', 'acetonitrile', 'benzene', 'CH2Cl2'.
            lower(), 'CHCl3'.lower(), 'CS2'.lower(), 'DMSO'.lower(),
            'ether', 'H2O'.lower(), 'methanol', 'THF'.lower(), 'toluene'}
        return solvent in valid_solvents
    elif gfn_version == 2:
        valid_solvents = {'acetone', 'acetonitrile', 'CH2Cl2'.lower(),
            'CHCl3'.lower(), 'CS2'.lower(), 'DMF'.lower(), 'DMSO'.lower(),
            'ether', 'H2O'.lower(), 'methanol', 'n-hexane'.lower(), 'THF'.
            lower(), 'toluene'}
        return solvent in valid_solvents
