import pathlib


def get_conv_path(conv):
    """
    Get path for conversation history as a string and make sure it exists
    """

    # construct directory path
    conv_dir = str(pathlib.Path.home()) + \
        "/.config/nuqql/conversation/{}/{}/{}".format(conv.backend.name,
                                                      conv.account.aid,
                                                      conv.name)
    # make sure directory exists
    pathlib.Path(conv_dir).mkdir(parents=True, exist_ok=True)

    return conv_dir