code: def export_to_xls(table, filename_or_fobj=None, sheet_name="Sheet1", *args, **kwargs):
      
  
      workbook = xlwt.Workbook()
      sheet = workbook.add_sheet(sheet_name)
  
      prepared_table = prepare_to_export(table, *args, **kwargs)
  
      field_names = next(prepared_table)
      for column_index, field_name in enumerate(field_names):
          sheet.write(0, column_index, field_name)
  
      _convert_row = _python_to_xls([table.fields.get(field) for field in field_names])
      for row_index, row in enumerate(prepared_table, start=1):
          for column_index, (value, data) in enumerate(_convert_row(row)):
              sheet.write(row_index, column_index, value, **data)
  
      return_result = False
      if filename_or_fobj is None:
          filename_or_fobj = BytesIO()
          return_result = True
  
      source = Source.from_file(filename_or_fobj, mode="wb", plugin_name="xls")
      workbook.save(source.fobj)
      source.fobj.flush()
  
      if return_result:
          source.fobj.seek(0)
          result = source.fobj.read()
      else:
          result = source.fobj
  
      if source.should_close:
          source.fobj.close()
  
      return result
docs: Export the rows.Table to XLS file and return the saved file.