<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read(filename, binary=True):
 """ Open and read a file :param filename: filename to open and read :param binary: True if the file should be read as binary :return: bytes if binary is True, str otherwise """

    with open(filename, 'rb' if binary else 'r') as f:
        return f.read()