def create_basis_set_from_directory(cls, label, dirpath, basis_type=None):
    """Construct a new basis set instance from a directory.

    .. warning:: the directory should not contain any subdirectories, just the basis files.

    :param cls: the basis set class to use, e.g. ``OpenmxBasisSet``
    :param label: the label for the new basis set.
    :param dirpath: absolute path to the directory holding the basis files.
    :param basis_type: subclass of ``BasisData`` to be used for the parsed bases. If not specified and
        the basis set only defines a single supported basis type in ``_basis_types`` then that will be used otherwise
        a ``ValueError`` is raised.
    :return: newly created basis set.
    :raises OSError: if the bases could not be parsed into a basis set.
    """
    try:
        basis_set = cls.create_from_folder(dirpath, label, basis_type=basis_type)
    except ValueError as exception:
        raise OSError(f'failed to parse bases from `{dirpath}`: {exception}') from exception

    return basis_set