docs: def zopen(filename, *args, **kwargs):
      """
      This function wraps around the bz2, gzip and standard python's open
      function to deal intelligently with bzipped, gzipped or standard text
      files.
  
      Args:
          filename (str/Path): filename or pathlib.Path.
          \*args: Standard args for python open(..). E.g., 'r' for read, 'w' for
              write.
          \*\*kwargs: Standard kwargs for python open(..).
  
      Returns:
          File-like object. Supports with context.
      """
      if Path is not None and isinstance(filename, Path):
          filename = str(filename)
  
      name, ext = os.path.splitext(filename)
      ext = ext.upper()
      if ext == ".BZ2":
          if PY_VERSION[0] >= 3:
              return bz2.open(filename, *args, **kwargs)
          else:
              args = list(args)
              if len(args) > 0:
                  args[0] = "".join([c for c in args[0] if c != "t"])
              if "mode" in kwargs:
                  kwargs["mode"] = "".join([c for c in kwargs["mode"]
                                            if c != "t"])
              return bz2.BZ2File(filename, *args, **kwargs)
      elif ext in (".GZ", ".Z"):
          return gzip.open(filename, *args, **kwargs)
      else:
          return io.open(filename, *args, **kwargs)