<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def xread(file, length):
    "Read exactly length bytes from file; raise EOFError if file ends sooner."
    data = file.read(length)
    if len(data) != length:
        raise EOFError
    return data