def get_variables(self, variable_names=None):
if isinstance(variable_names, string_types):<EOL><INDENT>variable_names = [variable_names]<EOL><DEDENT>elif variable_names is not None:<EOL><INDENT>variable_names = list(variable_names)<EOL><DEDENT>self.mat_stream.seek(<NUM_LIT:0>)<EOL>self.initialize_read()<EOL>mdict = {}<EOL>while not self.end_of_stream():<EOL><INDENT>hdr, next_position = self.read_var_header()<EOL>name = asstr(hdr.name)<EOL>if variable_names and name not in variable_names:<EOL><INDENT>self.mat_stream.seek(next_position)<EOL>continue<EOL><DEDENT>mdict[name] = self.read_var_array(hdr)<EOL>self.mat_stream.seek(next_position)<EOL>if variable_names:<EOL><INDENT>variable_names.remove(name)<EOL>if len(variable_names) == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>return mdict<EOL>
get variables from stream as dictionary

        Parameters
        ----------
        variable_names : None or str or sequence of str, optional
            variable name, or sequence of variable names to get from Mat file /
            file stream.  If None, then get all variables in file