

def generate_unique_name(backup_dir, environemnt, name_prefix):
    if (name_prefix and (name_prefix != '')):
        name_base = name_prefix
    else:
        name_base = environemnt['db_name']
    name_attempt = '{}__{}.dmp.zip'.format(name_base, datetime.utcnow().strftime('%Y_%m_%d'))
    name_attempt_full_path = os.path.join(backup_dir, name_attempt)
    if (not os.path.exists(name_attempt_full_path)):
        return name_attempt_full_path
    else:
        counter = 1
        while True:
            counter += 1
            name_attempt = '{}__{}_{}.dmp.zip'.format(name_base, datetime.utcnow().strftime('%Y_%m_%d'), counter)
            name_attempt_full_path = os.path.join(backup_dir, counter)
            if os.path.exists(name_attempt_full_path):
                continue
            else:
                return name_attempt_full_path

dataset/ETHPy150Open monarch-org/monarch/monarch/local.py generate_unique_name/VarMisuse@145/241 `name_attempt`->`counter`