def turn(facing, direction):
    """Returns the new facing given a cardinal facing and a left/right direction"""
    clockwise = "NESW"
    if direction == "L":
        facing = clockwise[(clockwise.index(facing) - 1) % 4]
    if direction == "R":
        facing = clockwise[(clockwise.index(facing) + 1) % 4]
    return facing