<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None):
 """ This method is called from everywhere in the code which accesses the database. If one of the parameters is set, these variables are overwritten for all others. """


        if cls.class_instance is None:
            if hostname is None and auth is None and protocol is None and port is None and database is None:
                cls.class_instance = Client(hostname='localhost')
            else:
                cls.class_instance = Client(hostname=hostname, auth=auth, protocol=protocol, port=port, database=database)
        else:
            if hostname is not None:
                cls.class_instance.hostname = hostname

            if protocol is not None:
                cls.class_instance.hostname = protocol

            if port is not None:
                cls.class_instance.hostname = port

            if database is not None:
                cls.class_instance.database = database

            if auth is not None:
                cls.class_instance.auth = auth

            cls.class_instance._create_api()

        return cls.class_instance