def export_data(filename_or_fobj, data, mode="<STR_LIT:w>"):
if filename_or_fobj is None:<EOL><INDENT>return data<EOL><DEDENT>_, fobj = get_filename_and_fobj(filename_or_fobj, mode=mode)<EOL>source = Source.from_file(filename_or_fobj, mode=mode, plugin_name=None)<EOL>source.fobj.write(data)<EOL>source.fobj.flush()<EOL>return source.fobj<EOL>
Return the object ready to be exported or only data if filename_or_fobj is not passed.