<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_edgestore_handle( client: arango.client.ArangoClient, username=None, password=None, edgestore_db_name: str = edgestore_db_name, edgestore_edges_name: str = edgestore_edges_name, edgestore_nodes_name: str = edgestore_nodes_name, edgestore_pipeline_name: str = edgestore_pipeline_name, edgestore_pipeline_stats_name: str = edgestore_pipeline_stats_name, edgestore_pipeline_errors_name: str = edgestore_pipeline_errors_name, ) -> arango.database.StandardDatabase: """Get Edgestore arangodb database handle Args: client (arango.client.ArangoClient):
 Description username (None, optional):
 Description password (None, optional):
 Description edgestore_db_name (str, optional):
 Description edgestore_edges_name (str, optional):
 Description edgestore_nodes_name (str, optional):
 Description Returns: arango.database.StandardDatabase: Description """


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

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

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

    # TODO - add a skiplist index for _from? or _key? to be able to do paging?
    # has_collection function doesn't seem to be working
    # if not edgestore_db.has_collection(edgestore_nodes_name):
    try:
        nodes = edgestore_db.create_collection(
            edgestore_nodes_name, index_bucket_count=64
        )
        nodes.add_hash_index(fields=["name"], unique=False)
        nodes.add_hash_index(
            fields=["components"], unique=False
        )  # add subject/object components as node properties
    except Exception:
        pass

    # if not edgestore_db.has_collection(edgestore_edges_name):
    try:
        edges = edgestore_db.create_collection(
            edgestore_edges_name, edge=True, index_bucket_count=64
        )
        edges.add_hash_index(fields=["relation"], unique=False)
        edges.add_hash_index(fields=["edge_types"], unique=False)
        edges.add_hash_index(fields=["nanopub_id"], unique=False)
        edges.add_hash_index(fields=["metadata.project"], unique=False)
        edges.add_hash_index(fields=["annotations[*].id"], unique=False)
    except Exception:
        pass

    # if not edgestore_db.has_collection(edgestore_pipeline_name):
    try:
        edgestore_db.create_collection(edgestore_pipeline_name)
    except Exception:
        pass

    try:
        edgestore_db.create_collection(edgestore_pipeline_errors_name)
    except Exception:
        pass

    try:
        edgestore_db.create_collection(edgestore_pipeline_stats_name)
    except arango.exceptions.CollectionCreateError as e:
        pass

    return edgestore_db