Various Pythonic simplifications

1. Use xor operator (^) for bitflip
   (at this point, the function call could be collapsed and just put
   into the expression (`newval = ord(val) ^ (1 << bit)`), but I've
   left that out, as the named function might be useful for reading)
2. Replace "if exp .. true else .. false" with "return expr"
3. Line continuation backslash is unnecessary if expression is
   put into parentheses
4. String slicing beyond string length works (return empty string)

For (4):

<q>[...] However, out of range slice indexes are handled gracefully when used for slicing: [...]</q>
(from https://docs.python.org/2/tutorial/introduction.html)