dports and sports are being pulled from the kwargs, if it's a list then it's built up on lines 221 and 240, so these lines shouldn't be necessary.  They also won't as though they'll work if dports and sports is specified as a string.