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

    if name is None:
        return None

    name = misc.transform_basis_name(name)
    metadata = api.get_metadata(data_dir)
    if not name in metadata:
        errstr = "Basis set '" + name + "' does not exist.\n"
        errstr += "For a complete list of basis sets, use the 'bse list-basis-sets' command"
        raise RuntimeError(errstr)

    return name
Checks that a basis set exists and if not, raises a helpful exception