def METHOD_NAME(self, params):
    export_format = params.get("format")
    items = operator.itemgetter(
        "model", "fields", "ids", "domain", "import_compat", "context", "user_ids"
    )(params)
    (model_name, fields_name, ids, domain, import_compat, context, user_ids) = items
    model = self.env[model_name].with_context(
        import_compat=import_compat, **context
    )
    records = model.browse(ids) or model.search(
        domain, offset=0, limit=False, order=False
    )
    if not model._is_an_ordinary_table():
        fields_name = [field for field in fields_name if field["name"] != "id"]
    field_names = [f["name"] for f in fields_name]
    import_data = records.export_data(field_names).get("datas", [])
    if import_compat:
        columns_headers = field_names
    else:
        columns_headers = [val["label"].strip() for val in fields_name]
    if export_format == "csv":
        csv = CSVExport()
        return csv.from_data(columns_headers, import_data)
    else:
        xls = ExcelExport()
        return xls.from_data(columns_headers, import_data)