Modifications to mock_open for Python 2.7 compatibility
Add support for writing to files