def get_offset_helper(widget, axis, smaller_coord_side):
    # Assume axis is X.  This function returns two values:
    # - An offset where the bounding box is placed at,
    # - Whether this offset is for the left or right edge.
    #
    # The input coordinate (widget.coord[axis]) is either:
    #
    # - a number: in this case, the offset is that number, and its sign determines whether this refers to the left or right edge of the bounding box.
    # - other_widget.edge.mode: this has multiple possibilities:
    #   * edge=left, mode=align: the offset is other_widget.left, the edge is left.
    #   * edge=left, mode=adjacent: the offset is other_widget.left, the edge is right.
    #   * edge=right, mode=align: the offset is other_widget.right, the edge is right.
    #   * edge=right, mode=adjacent: the offset is other_widget.right, the edge is left.
    #
    # The case for the Y axis is similar, with the edge values being top or bottom.

    coord = widget.coords[axis]
    if not isinstance(coord, unicode):
        is_left = coord >= 0
        return coord, is_left

    coord_split = coord.split('.')

    is_left = coord_split[1] == smaller_coord_side
    is_align = coord_split[2] == 'align'

    other_widget_coords = 'mState.mOverlayWidgets[WidgetId::' + coord_split[0] + ']->coords'
    other_widget_coord_index = axis + (0 if is_left else 2)
    offset = other_widget_coords + '[' + str(other_widget_coord_index) + ']'

    return offset, is_left == is_align