def get_database(conn, name):
    """Gets an arangodb database safely

    Returns an instance of an Arango database. If the database does not exist
    a new one will be created.

    :type conn: Connection
    :type name: str
    :rtype: Database
    """

    if conn.hasDatabase(name) is False:
        return conn.createDatabase(name)

    return conn[name]