<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def database(connection_string, db_class=SimplDB):
 """Return database singleton instance. This function will always return the same database instance for the same connection_string. It stores instances in a dict saved as an attribute of this function. """

    if not hasattr(database, "singletons"):
        database.singletons = {}
    if connection_string not in database.singletons:
        instance = db_class(connection_string)
        database.singletons[connection_string] = instance
    return database.singletons[connection_string]