I came across a code snippet as follows -
@classmethod
def new(cls, **props):
    '''Creates a new Thread instance, ensuring a unique _id.'''
    for i in range(5):
        try:
            thread = cls(**props)
            session(thread).flush(thread)
            return thread
            ...... continued
The name of the class it is defined is 'Thread'. This code creates a new thread object but I'm not able to understand how this particular code is trying to do that from the code in try block.
cls is a function?
 
     
     
    