<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _connect_database(config):
 """Create simple connection with Mongodb config comes with settings from .ini file. """

    settings = config.registry.settings

    mongo_uri = "mongodb://localhost:27017"
    mongodb_name = "test"

    if settings.get("mongo_url"):
        mongo_uri = settings["mongo_url"]

    if settings.get("mongodb_name"):
        mongodb_name = settings["mongodb_name"]

    return mongoengine.connect(mongodb_name, host=mongo_uri)