:= is the so called walrus operator. This operator allows to assign the value of an expression to a variable and evaluate this value in a boolean context (for example in an if or while statement):
if val := funcXYZ():
print(f'val = {val}')
The valrus operator was introduced in Version 3.8.