The Python examples in are all broken

The first example for creating nodes fails: I can make it work by removing the 'where' and 'return' clause and add the name directly in the first node but is this example even supposed to work?

from neo4j import GraphDatabase

uri = "neo4j://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

def create_friend_of(tx, name, friend):"CREATE (a:Person)-[:KNOWS]->(f:Person {name: $friend}) "
           "WHERE = $name "
           "RETURN AS friend", name=name, friend=friend)

with driver.session() as session:
    session.write_transaction(create_friend_of, "Alice", "Bob")

with driver.session() as session:
    session.write_transaction(create_friend_of, "Alice", "Carl")


and here is the error:

    response.on_failure(summary_metadata or {})
  File "/home/test/anaconda3/envs/jsonld/lib/python3.7/site-packages/neo4j/io/", line 541, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input 'H': expected 'i/I' (line 1, column 57 (offset: 56))
"CREATE (a:Person)-[:KNOWS]->(f:Person {name: $friend}) WHERE = $name RETURN AS friend"

again: if I change the code to this (see below) I get it to work but wouldn't it be nice if the example worked?

def create_friend_of(tx, name, friend):"CREATE (a:Person {name: $name})-[:KNOWS]->(f:Person {name: $friend})", name=name, friend=friend)

The second example also doesn't work but if you take off the ':' after name=name the exmple will

here is the wrong code with the colon that shouldn't be there

def get_friends_of(tx, name):
    friends = []
    result ="MATCH (a:Person)-[:KNOWS]->(f) "
                    "WHERE = $name "
                    "RETURN AS friend", name=name):
    for record in result:
    return friends