from pathlib import Path


def create_flag_file(filepath: str) -> str:
    """
    Create a flag file in order to avoid concurrent build of same previews
    :param filepath: file to protect
    :return: flag file path
    """
    flag_file_path = "{}_flag".format(filepath)
    Path(flag_file_path).touch()
    return flag_file_path