code: def file_or_path(file):
      
  
      is_path = False
      if isinstance(file, string_types):
          if not os.path.exists(file):
              raise IOError('File at path ' + file + ' does not exist.')
          file = open(file, 'rb')
          is_path = True
  
      return file, is_path
docs: Open a file and return the handler if a path is given.
      If a file handler is given, return it directly.
  
      :param file: A file handler or path to a file.
  
      :returns: A tuple with the open file handler and whether it was a path.
      :rtype: (file, bool)