docs: def open(self):
          """Open or re-open file."""
          if self._fh:
              return  # file is open
  
          if isinstance(self._file, pathlib.Path):
              self._file = str(self._file)
          if isinstance(self._file, basestring):
              # file name
              self._file = os.path.realpath(self._file)
              self._dir, self._name = os.path.split(self._file)
              self._fh = open(self._file, self._mode)
              self._close = True
              if self._offset is None:
                  self._offset = 0
          elif isinstance(self._file, FileHandle):
              # FileHandle
              self._fh = self._file._fh
              if self._offset is None:
                  self._offset = 0
              self._offset += self._file._offset
              self._close = False
              if not self._name:
                  if self._offset:
                      name, ext = os.path.splitext(self._file._name)
                      self._name = '%s@%i%s' % (name, self._offset, ext)
                  else:
                      self._name = self._file._name
              if self._mode and self._mode != self._file._mode:
                  raise ValueError('FileHandle has wrong mode')
              self._mode = self._file._mode
              self._dir = self._file._dir
          elif hasattr(self._file, 'seek'):
              # binary stream: open file, BytesIO
              try:
                  self._file.tell()
              except Exception:
                  raise ValueError('binary stream is not seekable')
              self._fh = self._file
              if self._offset is None:
                  self._offset = self._file.tell()
              self._close = False
              if not self._name:
                  try:
                      self._dir, self._name = os.path.split(self._fh.name)
                  except AttributeError:
                      self._name = 'Unnamed binary stream'
              try:
                  self._mode = self._fh.mode
              except AttributeError:
                  pass
          else:
              raise ValueError('The first parameter must be a file name, '
                               'seekable binary stream, or FileHandle')
  
          if self._offset:
              self._fh.seek(self._offset)
  
          if self._size is None:
              pos = self._fh.tell()
              self._fh.seek(self._offset, 2)
              self._size = self._fh.tell()
              self._fh.seek(pos)
  
          try:
              self._fh.fileno()
              self.is_file = True
          except Exception:
              self.is_file = False