<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def writeFrame(self, data):
 """Write the received frame to a temp image file. Return the image file."""


    cachename = CACHE_FILE_NAME + str(self.sessionId) + CACHE_FILE_EXT

    try:
      file = open(cachename, "wb")
    except:
      print "file open error"

    try:
      file.write(data)
    except:
      print "file write error"

    file.close()

    return cachename