code: def _get_expr_or_join(expr, source, other_source, loc):
      if source != other_source:
          if isinstance(source, hl.MatrixTable):
              source = source.annotate_rows(**{loc: expr})
          else:
              source = source.annotate(**{loc: expr})
          expr = source[other_source.row_key][loc]
      return expr
  
imports: import hail
  from hail.typecheck import typecheck
  from hail.expr.expressions import expr_call, expr_numeric, expr_array, raise_unless_entry_indexed, raise_unless_row_indexed
label_desc: Use image node_id 2 for calling a global function with example usage: _get_expr_or_join(expr, source, other_source, loc) and returns: expr