get the value under the 'database' key of the options dictionary, use it as a key to access the element under the connections dictionary, substitute it for connection.
connection = connections [ options . get ( 'database' ) ]