+ @staticmethod
+ def _compat_open_path(path):
+ # type: (pathlib.Path)
+ """
+ The builtin open() in python >= 3.6 expects a path-like object while
+ prior versions expect a string or bytes object. Return the correct type
+ based on the presence of the "__fspath__" attribute specified in PEP-519.
+ """
+ if hasattr(path, "__fspath__"):
+ return path
+ else:
+ return str(path)
+