def validate_basis_string(instr):
    """ validate that only one basis set is present,
    in a recognised format

    :param instr: content of basis set
    :return: passed
    """
    lines = instr.strip().splitlines()
    indx = 0
    try:
        anum, nshells = lines[indx].strip().split()
        anum, nshells = int(anum), int(nshells)
    except ValueError:
        raise ValueError("expected 'anum nshells': {}".format(lines[indx].
            strip()))
    for i in range(nshells):
        indx += 1
        try:
            btype, stype, nfuncs, charge, scale = lines[indx].strip().split()
            btype, stype, nfuncs = [int(i) for i in [btype, stype, nfuncs]]
            charge, scale = [float(i) for i in [charge, scale]]
        except ValueError:
            raise ValueError(
                "expected 'btype, stype, nfuncs, charge, scale': {}".format
                (lines[indx].strip()))
        if btype == 0:
            for _ in range(nfuncs):
                indx += 1
    if len(lines) > indx + 1:
        raise ValueError(
            """the basis set string contains more than one basis set or has trailing empty lines:
{}"""
            .format(instr))
    return True
