code: def _openfile(h5file):
      
      if isinstance(h5file, h5py.File):
          f = h5file
          opened = False
      elif isinstance(h5file, basestring):
          f = h5py.File(h5file)
          opened = True
      else:
          msg = "h5file must be a h5py.File object or a string (path)."
          raise TypeError, msg    
      return f, opened
docs: Open an archive if input is a path.
      
      Parameters
      ----------
      h5file : str or h5py.File
          Filename or h5py.File instance of the archive.
          
      Returns
      ------- 
      f : h5py.File
          Returns a h5py.File instance.
      opened : bool
          True is `h5file` is a path; False if `h5file` is a h5py.File object.