Implement first_true function

The implementation is an exact copy of 3.4's 

An extra commit was added for trimming blank spaces on line endings