def get_engine(config):
    database_timeout = -1
    try:
        database_timeout = int(config.get('Database', 'Timeout', fallback=-1))
        if database_timeout > 0:
            print('Reconnecting to MySQL (through SQLAlchemy\'s pool_recycle) every ' + str(database_timeout) +
                  ' seconds')
    except:
        database_timeout = -1
    try:
        return create_engine(config.get_db_engine_string(), encoding='utf-8', pool_recycle=database_timeout)
    except:
        print('Error: Database engine could not be created (' + config.get_db_engine_string() + ')')
        error = sys.exc_info()[0]
        if error is not None:
            print('- ' + str(error))
            print('- ' + traceback.format_exc())
        exit(1)