def METHOD_NAME(transName, unique=True):
    """
    Get a transformation name from a base name.
    If unique is requested, return None if it already exists and is not in a final state.
    If unique is requested and the transformation is final increments index
    until an unfinished transformation is found (results in None),
    or a final one is found and the name with one higher index is returned.
    """
    tName = transName
    trial = 0
    transClient = TransformationClient()
    while True:
        # Check if there is already a transformation with that name
        res = transClient.getTransformation(tName)
        if not res["OK"]:
            # Transformation doesn't exist, OK
            break
        # Transformation already exists
        if unique:
            if res["Value"]["Status"] not in TransformationStatus.TRANSFORMATION_FINAL_STATES:
                tName = None
                gLogger.notice(
                    f"Transformation {transName} already exists with ID {res['Value']['TransformationID']}, status {res['Value']['Status']}"
                )
                break
        trial += 1
        # Check again with new name
        tName = transName + "-" + str(trial)
    return tName