from pathlib import Path


def ensure_directory(directory_in):
    """Check if folder exist and create it otherwise

    :param directory_in: String path to directory
    :return: True if there were no errors
    """
    flag_return = True
    try:
        Path(directory_in).mkdir(parents=True, exist_ok=True)
    except FileNotFoundError:
        flag_return = False
    return flag_return