def get_or_create_user(screen_name):
    """Return the user if exists, create one if not"""
return cypher_merge_user.execute_one(name=screen_name)

def get_or_create_users(screen_names):
    """Apply the get or create user cypher query to many usernames in a 
    batch transaction"""
batch = neo4j.WriteBatch(graph_db)
for screen_name in screen_names:
    batch.append_cypher(cypher_merge_user, params=dict(name=screen_name))
return batch.submit()
root = get_or_create_user('Root')
users = get_or_create_users(['alice', 'bob', 'charlie'])
Failed WriteBatch Operation with py2neo