To set layers 2 & 5, you would use:
To calculate the integer argument for
set_collision_mask() you take your desired layer bits, and raise 2 to the power of each layer number.
So, to set layers 2 & 5, you have
2^2 + 2^5, which is
32 + 4 = 36. Note that you can see the values in the UI when you hover over the checkboxes, it will say something like "Bit 4, Val 16"
If you want to check that you've set things correctly in code, you can do a test print:
for i in range(20):
print(i, '\t', get_collision_mask_bit(i))
and you'll see a list of each bit and its value.