def METHOD_NAME(expr: object) -> MemoryReference:
    """Get a suitable MemoryReference for a given expression."""
    nonlocal mref_idx
    expr = str(expr)
    if expr in seen_exprs:
        return seen_exprs[expr]
    new_mref = MemoryReference(mref_name, mref_idx)
    seen_exprs[expr] = new_mref
    mref_idx += 1
    recalculation_table[aref(new_mref)] = expr
    return new_mref