'how to add type hint for function return something I don't Know

How Can I add type hint for conn.cursor()?

class DBManager:

  def connect(self, dbname:str, user:str, password:str):
    """Create Connection to the Postgre database using Json File have the required data in it 
    1.dbname
    2.user
    2.password (if there was)
    return Curser Object or 0 if Can't """
    try:
      conn = psycopg2.connect(dbname=dbname, user=user, password=password,cursor_factory=RealDictCursor)
      return conn.cursor()
    except:
      return 0


Solution 1:[1]

Possibly the Any type is what you are looking for.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 grmmgrmm