Is It Possible to Select Faces (in Edit Mode) Based on the Normals of the Faces Connected to It?
Select +Z faces and neighboring -Y faces if they go down:
import bpy, bmesh
from mathutils import Vector

up = Vector((0, 0, 1))
side = Vector((0, -1, 0))

def main():
    me = bpy.context.active_object.data
    bm = bmesh.from_edit_mesh(me)
    for face in bm.faces:
        if face.normal == up:
            face.select = True
            conditional_select_neighbors(face)
    bmesh.update_edit_mesh(me)


def conditional_select_neighbors(face):
    for loop in face.loops:  # each edge has a 'loop' associated with it for each face
        loop2 = loop.link_loop_radial_next  # radial_next gets the loop of the same edge but another face
        is_side = loop2.face.normal == side  # as R. Betts spotted, this is not enough
        loop3 = loop2.link_loop_next.link_loop_next
        is_lower = loop.vert.co.z &gt; loop3.vert.co.z  
        if is_side and is_lower:
            loop2.face.select = True


if __name__ == &quot;__main__&quot;:
    main()

Select +Z faces without -Y neighbors:
import bpy, bmesh
from mathutils import Vector

up = Vector((0, 0, 1))
side = Vector((0, -1, 0))

def main():
    me = bpy.context.active_object.data
    bm = bmesh.from_edit_mesh(me)
    for face in bm.faces:
        if face.normal == up:
            conditional_select(face)
    bmesh.update_edit_mesh(me)


def conditional_select(face):
    face.select = True
    for loop in face.loops:  # each edge has a 'loop' associated with it for each face
        loop2 = loop.link_loop_radial_next  # radial_next gets the loop of the same edge but another face
        if loop2.face.normal == side:  # in this case this is enough
            face.select = False


if __name__ == &quot;__main__&quot;:
    main()