<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_class_file(filename):
 """ checks whether the given file is a Java class file, by opening it and checking for the magic header """


    with open(filename, "rb") as fd:
        c = fd.read(len(JAVA_CLASS_MAGIC))
        if isinstance(c, str):      # Python 2
            c = map(ord, c)
        return tuple(c) == JAVA_CLASS_MAGIC