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

def factory(fileobject, jfs, parentpath): # fileobject from lxml.objectify
        'Class method to get the correct file class instatiated'
        if hasattr(fileobject, 'currentRevision'): # a normal file
            return JFSFile(fileobject, jfs, parentpath)
        elif str(fileobject.latestRevision.state) == ProtoFile.STATE_INCOMPLETE:
            return JFSIncompleteFile(fileobject, jfs, parentpath)
        elif str(fileobject.latestRevision.state) == ProtoFile.STATE_CORRUPT:
            return JFSCorruptFile(fileobject, jfs, parentpath)
        else:
            raise NotImplementedError('No JFS*File support for state %r. Please file a bug!' % fileobject.latestRevision.state)