def METHOD_NAME(cmdline):
    from sdaps import csvdata
    survey = model.survey.Survey.load(cmdline['project'])
    if cmdline['output']:
        if cmdline['output'] == '-':
            outfd = os.dup(sys.stdout.fileno())
            outfile = os.fdopen(outfd, 'w', encoding='utf-8')
        else:
            filename = cmdline['output']
            outfile = open(filename, 'w', encoding='utf-8')
    else:
        filename = survey.new_path('data_%i.csv')
        outfile = open(filename, 'w', encoding='utf-8')
    csvoptions = { 'delimiter' : cmdline['delimiter'] }
    if cmdline['export_images'] or cmdline['export_question_images'] and cmdline['output'] != '-':
        from sdaps.utils.image import ImageWriter
        img_path = os.path.dirname(filename)
        img_prefix = os.path.join(os.path.splitext(os.path.basename(filename))[0], 'img')
        image_writer = ImageWriter(img_path, img_prefix)
    else:
        image_writer = None
    return csvdata.METHOD_NAME(survey, outfile, image_writer,
        filter=cmdline['filter'],
        export_images=cmdline['export_images'],
        export_question_images=cmdline['export_question_images'],
        export_quality=cmdline['export_quality'],
        csvoptions=csvoptions)