<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_belapi_handle(client, username=None, password=None):
 """Get BEL API arango db handle"""


    (username, password) = get_user_creds(username, password)

    sys_db = client.db("_system", username=username, password=password)

    # Create a new database named "belapi"
    try:
        if username and password:
            belapi_db = sys_db.create_database(
                name=belapi_db_name,
                users=[{"username": username, "password": password, "active": True}],
            )
        else:
            belapi_db = sys_db.create_database(name=belapi_db_name)
    except arango.exceptions.DatabaseCreateError:
        if username and password:
            belapi_db = client.db(belapi_db_name, username=username, password=password)
        else:
            belapi_db = client.db(belapi_db_name)

    try:
        belapi_db.create_collection(belapi_settings_name)
    except Exception:
        pass

    try:
        belapi_db.create_collection(belapi_statemgmt_name)
    except Exception:
        pass

    return belapi_db