def METHOD_NAME(btpUsecase, service):
    result = "instance"
    if service.category != "CF_CUP_SERVICE":
        if service.instancename is not None:
            return service.instancename
        else:
            result = (
                service.name + "-" + service.plan + "-" + btpUsecase.suffixinstancename
            )
        result = re.sub(r"[^\w\s]", "-", result)
        result = result.replace("--", "-")
        result = result.replace("_", "-")
        if result[len(result) - 1] == "-":
            result = result[:-1]
        result = result[:40]
    else:
        result += "-" + service.name
    return result