import toml


def readToml(filename):
    """Read a single TOML configuration file, or return an empty dict
    if it doesn't exist.
    """
    try:
        with open(filename, encoding='utf-8') as fp:
            return toml.load(fp)
    except OSError:
        return {}
    except toml.TomlDecodeError as err:
        raise RuntimeError(
            f'could not read NICOS config file at {filename!r},'
            f' please make sure it is valid TOML: {err}') from None