class_docstr: Generic matlab matrix writing class 
class_docstr_tok: ["Generic","matlab","matrix","writing","class"]
docstr: write tag and data 
code: def write_element(self, arr, mdtype=None):
      """write tag and data"""
      if mdtype is None:
          mdtype = NP_TO_MTYPES[arr.dtype.str[1:]]
      # Array needs to be in native byte order
      if arr.dtype.byteorder == swapped_code:
          arr = arr.byteswap().newbyteorder()
      byte_count = arr.size * arr.itemsize
      if byte_count <= 4:
          self.write_smalldata_element(arr, mdtype, byte_count)
      else:
          self.write_regular_element(arr, mdtype, byte_count)
  
imports: from __future__ import division, print_function, absolute_import
  import os
  import time
  import sys
  import zlib
  from io import BytesIO
  import warnings
  import numpy
  from numpy.compat import asbytes, asstr
  import scipy.sparse
  from scipy._lib.six import string_types
  from .byteordercodes import native_code, swapped_code
  from .miobase import MatFileReader, docfiller, matdims, read_dtype, arr_to_chars, arr_dtype_number, MatWriteError, MatReadError, MatReadWarning
  from .mio5_utils import VarReader5
  from .mio5_params import MatlabObject, MatlabFunction, MDTYPES, NP_TO_MTYPES, NP_TO_MXTYPES, miCOMPRESSED, miMATRIX, miINT8, miUTF8, miUINT32, mxCELL_CLASS, mxSTRUCT_CLASS, mxOBJECT_CLASS, mxCHAR_CLASS, mxSPARSE_CLASS, mxDOUBLE_CLASS, mclass_info
  from .streams import ZlibInputStream
label_desc: Use image node_id 4 for calling the VarWriter5 obj's underlying member method code with example usage: obj.write_element(arr, mdtype) without return types