def building_marker_fn(record):

    # Use Marker in preferential order
    if record.asbestos == 1:
        marker = "hazmat"
    else:
        marker = "residence"

    # Colour code by priority
    priority = record.priority
    if priority == 1:
        # High
        marker = "%s_red" % marker
    elif priority == 2:
        # Medium
        marker = "%s_yellow" % marker
    elif priority == 3:
        # Low
        marker = "%s_green" % marker

    mtable = db.gis_marker
    try:
        marker = db(mtable.name == marker).select(mtable.image,
                                                  mtable.height,
                                                  mtable.width,
                                                  cache=s3db.cache,
                                                  limitby=(0, 1)
                                                  ).first()
    except:
        marker = db(mtable.name == "residence").select(mtable.image,
                                                       mtable.height,
                                                       mtable.width,
                                                       cache=s3db.cache,
                                                       limitby=(0, 1)
                                                       ).first()
    return marker

# -----------------------------------------------------------------------------
Function to decide which Marker to use for Building Assessments Map
dataset/ETHPy150Open sahana/eden/controllers/assess.py/building_marker_fn