class_docstr: Reader for Mat 5 mat files
  Adds the following attribute to base class
  
  uint16_codec - char codec to use for uint16 char arrays
      (defaults to system default codec)
  
  Uses variable reader that has the following standard interface (see
  abstract class in ``miobase``::
  
     __init__(self, file_reader)
     read_header(self)
     array_from_header(self)
  
  and added interface::
  
     set_stream(self, stream)
     read_full_tag(self)
docstr: get variables from stream as dictionary
  
  variable_names   - optional list of variable names to get
  
  If variable_names is None, then get all variables in file
docstr_tok: ["get","variables","from","stream","as","dictionary","variable_names","-","optional","list","of","variable","names","to","get","If","variable_names","is","None",",","then","get","all","variables","in","file"]
code: def get_variables(self, variable_names=None):
      """get variables from stream as dictionary
  
      variable_names   - optional list of variable names to get
  
      If variable_names is None, then get all variables in file
      """
      if isinstance(variable_names, str):
          variable_names = [variable_names]
      elif variable_names is not None:
          variable_names = list(variable_names)
  
      self.mat_stream.seek(0)
      # Here we pass all the parameters in self to the reading objects
      self.initialize_read()
      mdict = self.read_file_header()
      mdict["__globals__"] = []
      while not self.end_of_stream():
          hdr, next_position = self.read_var_header()
          name = (
              "None" if hdr.name is None else hdr.name.decode("latin1")
          )
          if name in mdict:
              warnings.warn(
                  'Duplicate variable name "%s" in stream'
                  " - replacing previous with new\n"
                  "Consider mio5.varmats_from_mat to split "
                  "file into single variable files" % name,
                  MatReadWarning,
                  stacklevel=2,
              )
          if name == "":
              # can only be a matlab 7 function workspace
              name = "__function_workspace__"
              # We want to keep this raw because mat_dtype processing
              # will break the format (uint8 as mxDOUBLE_CLASS)
              process = False
          else:
              process = True
          if variable_names is not None and name not in variable_names:
              self.mat_stream.seek(next_position)
              continue
          try:
              res = self.read_var_array(hdr, process)
          except MatReadError as err:
              warnings.warn(
                  f'Unreadable variable "{name}", because "{err}"',
                  Warning,
                  stacklevel=2,
              )
              res = "Read error: %s" % err
          self.mat_stream.seek(next_position)
          mdict[name] = res
          if hdr.is_global:
              mdict["__globals__"].append(name)
          if variable_names is not None:
              variable_names.remove(name)
              if len(variable_names) == 0:
                  break
      if self.simplify_cells:
          return _simplify_cells(mdict)
      else:
          return mdict
  
imports: import os
  import time
  import sys
  import zlib
  from io import BytesIO
  import warnings
  import numpy
  import scipy.sparse
  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, mat_struct
  from ._streams import ZlibInputStream
label_desc: Use image node_id 7 for calling the MatFile5Reader obj's underlying member method code with example usage: obj.get_variables(variable_names) and returns: _simplify_cells, mdict