Refactor test_utils_rfc8040.py portmapping methods