Transform the argument into lowercase by using
type = str.lower
for the -p
switch.
This solution was pointed out by chepner in a comment. The solution I proposed earlier was
type = lambda s : s.lower()
which is also valid, but it’s simpler to just use str.lower
.