def METHOD_NAME(cpu):
    if cpu > 0:
        if cpu < NodeResourceLimit.MIN_CPU_CORES:
            cpu = NodeResourceLimit.MIN_CPU_CORES
        elif cpu > NodeResourceLimit.MAX_CPU_CORES:
            cpu = NodeResourceLimit.MAX_CPU_CORES
    return cpu