'Helper function to load all models'

@classmethod
def load_all_models(cls):

    s3 = current.response.s3
    if s3.all_models_loaded:
        return
    s3.load_all_models = True
    models = current.models
    if (models is not None):
        for name in models.__dict__:
            if (type(models.__dict__[name]).__name__ == 'module'):
                cls.load(name)
    from s3import import S3Importer, S3ImportJob
    S3Importer.define_upload_table()
    S3ImportJob.define_job_table()
    S3ImportJob.define_item_table()
    if current.deployment_settings.get_base_session_db():
        current.db.define_table('web2py_session', Field('locked', 'boolean', default=False), Field('client_ip', length=64), Field('created_datetime', 'datetime', default=current.request.now), Field('modified_datetime', 'datetime'), Field('unique_key', length=64), Field('session_data', 'blob'))
    s3.load_all_models = False
    s3.all_models_loaded = True
