def export(context, keywords, module, update):
    """Operate on libraries and exported functions.

    Query the module name containing the function by default.

    Windows database must be prepared before using this.
    """
    logging.info(_('Export Mode'))
    database = context.obj['sense']
    none = True
    if update:
        exports = OrderedDict()
        from .executables.pe import PE
        for filename in keywords:
            module = split_ext(filename, basename=True)[0]
            with open(filename, 'rb') as stream:
                exports.update(
                    {module: PE(stream).get_export_table()})
        database.make_export(exports)
        none = False
    elif module:
        for module_name in keywords:
            funcs = database.query_module_funcs(module_name)
            if funcs:
                none = False
                print(', '.join(map(str, funcs)))
            else:
                logging.warning(_('No function for module: %s'),
                                module_name)
    else:
        for func_name in keywords:
            module_name = database.query_func_module(func_name)
            if module_name:
                none = False
                print(repr(module_name))
            else:
                logging.warning(_('No module for function: %s'),
                                func_name)
    sys.exit(1 if none else 0)
Operate on libraries and exported functions.

    Query the module name containing the function by default.

    Windows database must be prepared before using this.