def dump_data(data,<EOL>filename=None,<EOL>file_type='<STR_LIT>',<EOL>klazz=YapconfError,<EOL>open_kwargs=None,<EOL>dump_kwargs=None):
_check_file_type(file_type, klazz)<EOL>open_kwargs = open_kwargs or {'<STR_LIT>': '<STR_LIT:utf-8>'}<EOL>dump_kwargs = dump_kwargs or {}<EOL>if filename:<EOL><INDENT>with open(filename, '<STR_LIT:w>', **open_kwargs) as conf_file:<EOL><INDENT>_dump(data, conf_file, file_type, **dump_kwargs)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>_dump(data, sys.stdout, file_type, **dump_kwargs)<EOL><DEDENT>
Dump data given to file or stdout in file_type.

    Args:
        data (dict): The dictionary to dump.
        filename (str, optional): Defaults to None. The filename to write
        the data to. If none is provided, it will be written to STDOUT.
        file_type (str, optional): Defaults to 'json'. Can be any of
        yapconf.FILE_TYPES
        klazz (optional): Defaults to YapconfError a special error to throw
        when something goes wrong.
        open_kwargs (dict, optional): Keyword arguments to open.
        dump_kwargs (dict, optional): Keyword arguments to dump.