Dumps a data structure to TOML source code.

    The given value must be either a dict of dict values, a dict, or a TOML file constructed by this module.

def dumps(value):
    """
    Dumps a data structure to TOML source code.

    The given value must be either a dict of dict values, a dict, or a TOML file constructed by this module.
    """

    from contoml.file.file import TOMLFile

    if not isinstance(value, TOMLFile):
        raise RuntimeError("Can only dump a TOMLFile instance loaded by load() or loads()")

    return value.dumps()