from pathlib import Path


def _convert_pathlib_path(path):
    """Helper function used to convert an instance of pathlib.Path into a
    unicode string.
    """

    if Path is None:
        return path

    if isinstance(path, Path):
        return str(path)

    return path