code: def _open_file(file_like, appendmat):
      """
      Open `file_like` and return as file-like object. First, check if object is
      already file-like; if so, return it as-is. Otherwise, try to pass it
      to open(). If that fails, and `file_like` is a string, and `appendmat` is true,
      append '.mat' and try again.
      """
      try:
          file_like.read(0)
          return file_like, False
      except AttributeError:
          pass
  
      try:
          return open(file_like, "rb"), True
      except IOError:
          # Probably "not found"
          if isinstance(file_like, string_types):
              if appendmat and not file_like.endswith(".mat"):
                  file_like += ".mat"
              return open(file_like, "rb"), True
          else:
              raise IOError(
                  "Reader needs file name or open file-like object"
              )
  
file_path: catboost/contrib/python/scipy/py2/scipy/io/matlab/mio.py
imports: from __future__ import division, print_function, absolute_import
  from scipy._lib.six import string_types
  from .miobase import get_matfile_version, docfiller
  from .mio4 import MatFile4Reader, MatFile4Writer
  from .mio5 import MatFile5Reader, MatFile5Writer
label_desc: Use image node_id 1 for calling a global function with example usage: _open_file(file_like, appendmat) and returns: file_like,  False, open,  True, open,  True