<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def determine_newline(data):
 """ Looks for a newline character in bytestring parameter 'data'. Currently only looks for strings '\r\n', '\n'. If '\n' is found at the first position of the string, this raises an exception. Parameters: data (bytes):
 The data to be searched Returns: None: If no-newline is found One of '\n', '\r\n': whichever is found first """

        line_end_pos = data.find(b'\n')

        if line_end_pos == -1:
            return None
        elif line_end_pos == 0:
            return b'\n'

        prev_char = data[line_end_pos - 1]

        return b'\r\n' if (prev_char is b'\r'[0]) else b'\n'