code: 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.statef 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)
docs: Class method to get the correct file class instatiated