get the value under the 'database' key of the options dictionary, use it as the key to get the value from the connections dictionary, substitute the result for connection.
connection = connections [ options [ 'database' ] ]