import uuid


def get_exec_path(model, model_size, batch_size, batches_per_step, filenames, use_generated_data,
                  use_tmp_execs):
    """
    Return the path to compiled graph based on model parameters
    or random name if that was requested by setting an option.
    """
    if use_tmp_execs:
        random_part = str(uuid.uuid4())
        poplar_exec_filepath = f"model_{random_part}.poplar_exec"
    else:
        ckpt_name = filenames[0].split('/')[-1] if len(filenames) else 'random'
        label_phrase = "nolabels" if use_generated_data else "withlabels"
        poplar_exec_filepath = (f"model_{model}{model_size}_bs_{str(batch_size)}_"
                                f"bps_{str(batches_per_step)}_{str(ckpt_name)}_{label_phrase}"
                                f".poplar_exec")
    return poplar_exec_filepath