:param mode: the same as the argument `mode` of `builtins.open`
        :param encoding: similar to the argument `encoding` of `builtins.open` which is compatible to io.open.
                         - `encoding='auto'` to automatically detect the encoding.
                         - `encoding is a <list|tuple|set>` to automatically detect the encoding from the limited collection.
                         - `encoding=<function>`
                            If you want to apply custom encoding detection method, you could pass
                            an encoding detecting function `(filename: str) -> (encoding: str)` here
                            which receives the filename and returns encoding of the file.
        :return: the same as the return of ``builtins.open`.

def open(self,
             mode='r',
             encoding: typing.Union[list, tuple, set, str, typing.
                                    Callable] = 'auto'):
        """
        :param mode: the same as the argument `mode` of `builtins.open`
        :param encoding: similar to the argument `encoding` of `builtins.open` which is compatible to io.open.
                         - `encoding='auto'` to automatically detect the encoding.
                         - `encoding is a <list|tuple|set>` to automatically detect the encoding from the limited collection.
                         - `encoding=<function>`
                            If you want to apply custom encoding detection method, you could pass
                            an encoding detecting function `(filename: str) -> (encoding: str)` here
                            which receives the filename and returns encoding of the file.
        :return: the same as the return of ``builtins.open`.

        """

        if 'b' in mode:
            return io.open(str(self), mode)

        if callable(encoding):
            return self.open(mode, encoding=encoding(str(self)))

        if isinstance(encoding, (tuple, list, set)):
            return default_auto_open(encoding, self, mode)

        if encoding == 'auto':
            return default_auto_open(_encodings, self, mode)

        return io.open(str(self), mode, encoding=encoding)