<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _cli_check_family(family, data_dir):
    '''Checks that a basis set family exists and if not, raises a helpful exception'''

    if family is None:
        return None

    family = family.lower()
    if not family in api.get_families(data_dir):
        errstr = "Basis set family '" + family + "' does not exist.\n"
        errstr += "For a complete list of families, use the 'bse list-families' command"
        raise RuntimeError(errstr)

    return family