<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def choose_uri(metadata, config):
 """ Choose the database URI to use. """

    database_name = choose_database_name(metadata, config)
    driver = config.driver
    host, port = config.host, config.port
    username, password = choose_username(metadata, config), config.password

    return f"{driver}://{username}:{password}@{host}:{port}/{database_name}"