def _export(self, opts):
    if (not opts.filename):
        _exit_if_errors(['--file is needed to export a function'])
    if (not opts.name):
        _exit_if_errors(['--name is needed to export a function'])
    (functions, errors) = self.rest.export_functions()
    _exit_if_errors(errors)
    exported_function = None
    for function in functions:
        if (function['appname'] == opts.name):
            exported_function = [function]
    if (not exported_function):
        _exit_if_errors([f'Function {opts.name} does not exist'])
    _exit_on_file_write_failure(opts.filename, json.dumps(exported_function, separators=(',', ':')))
    _success(('Function exported to: ' + opts.filename))
def _export(self, opts):
    if (not opts.filename):
        _exit_if_errors(['--file is needed to export a function'])
    if (not opts.name):
        _exit_if_errors(['--name is needed to export a function'])
    (functions, errors) = self.rest.export_functions()
    _exit_if_errors(errors)
    exported_function = None
    for function in functions:
        if (function['appname'] == opts.name):
            exported_function = [function]
    if (not exported_function):
        _exit_if_errors([f'Function {opts.name} does not exist'])
    _exit_on_file_write_failure(opts.filename, json.dumps(exported_function, separators=(',', ':')))
    _success(('Function exported to: ' + opts.filename))