docstr: Return an open file stream for reading based on source.
  
  If source is a file name, open it (after trying to find it with mtx and
  gzipped mtx extensions).  Otherwise, just return source.
  
  Parameters
  ----------
  filespec : str or file-like
      String giving file name or file-like object
  mode : str, optional
      Mode with which to open file, if `filespec` is a file name.
  
  Returns
  -------
  fobj : file-like
      Open file-like object.
  close_it : bool
      True if the calling function should close this file when done,
      false otherwise.
docstr_tok: ["Return","an","open","file","stream","for","reading","based","on","source",".","If","source","is","a","file","name",",","open","it","(","after","trying","to","find","it","with","mtx","and","gzipped","mtx","extensions",")",".","Otherwise",",","just","return","source",".","Parameters","--","--","--","--","--","filespec",":","str","or","file-like","String","giving","file","name","or","file-like","object","mode",":","str",",","optional","Mode","with","which","to","open","file",",","if","`","filespec","`","is","a","file","name",".","Returns","--","--","--","-","fobj",":","file-like","Open","file-like","object",".","close_it",":","bool","True","if","the","calling","function","should","close","this","file","when","done",",","false","otherwise","."]
code: def _open(filespec, mode="rb"):
      """Return an open file stream for reading based on source.
  
      If source is a file name, open it (after trying to find it with mtx and
      gzipped mtx extensions).  Otherwise, just return source.
  
      Parameters
      ----------
      filespec : str or file-like
          String giving file name or file-like object
      mode : str, optional
          Mode with which to open file, if `filespec` is a file name.
  
      Returns
      -------
      fobj : file-like
          Open file-like object.
      close_it : bool
          True if the calling function should close this file when done,
          false otherwise.
      """
      close_it = False
      if isinstance(filespec, string_types):
          close_it = True
  
          # open for reading
          if mode[0] == "r":
              # determine filename plus extension
              if not os.path.isfile(filespec):
                  if os.path.isfile(filespec + ".mtx"):
                      filespec = filespec + ".mtx"
                  elif os.path.isfile(filespec + ".mtx.gz"):
                      filespec = filespec + ".mtx.gz"
                  elif os.path.isfile(filespec + ".mtx.bz2"):
                      filespec = filespec + ".mtx.bz2"
              # open filename
              if filespec.endswith(".gz"):
                  import gzip
  
                  stream = gzip.open(filespec, mode)
              elif filespec.endswith(".bz2"):
                  import bz2
  
                  stream = bz2.BZ2File(filespec, "rb")
              else:
                  stream = open(filespec, mode)
  
          # open for writing
          else:
              if filespec[-4:] != ".mtx":
                  filespec = filespec + ".mtx"
              stream = open(filespec, mode)
      else:
          stream = filespec
  
      return stream, close_it
  
imports: from __future__ import division, print_function, absolute_import
  import os
  import sys
  from numpy import asarray, real, imag, conj, zeros, ndarray, concatenate, ones, can_cast
  from numpy.compat import asbytes, asstr
  from scipy._lib.six import string_types
  from scipy.sparse import coo_matrix, isspmatrix
label_desc: Use image node_id 14 for calling the MMFile obj's underlying member method code with example usage: obj._open(filespec, mode) and returns: stream,  close_it